- if(!cipher_decrypt(&c->incipher, bufp, inlen, c->buffer->input->buffer, &outlen, false) || inlen != outlen) {
- logger(LOG_ERR, _("Error while decrypting metadata from %s (%s)"), c->name, c->hostname);
- return false;
- }
+ if(!request) {
+ return true;
+ }
+
+ /* Are we receiving a TCPpacket? */
+
+ if(c->tcplen) {
+ abort(); // TODO: get rid of tcplen altogether
+ }
+
+ /* Change newline to null byte, just like non-SPTPS requests */
+
+ if(request[length - 1] == '\n') {
+ request[length - 1] = 0;
+ }
+
+ /* Otherwise we are waiting for a request */
+
+ return receive_request(mesh, c, request);
+}
+
+bool receive_meta(meshlink_handle_t *mesh, connection_t *c) {
+ int inlen;
+ char inbuf[MAXBUFSIZE];