+ /* 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];
+
+ inlen = recv(c->socket, inbuf, sizeof(inbuf), 0);
+
+ if(inlen <= 0) {
+ if(!inlen || !errno) {
+ logger(mesh, MESHLINK_INFO, "Connection closed by %s", c->name);
+ } else if(sockwouldblock(sockerrno)) {
+ return true;
+ } else {
+ logger(mesh, MESHLINK_ERROR, "Metadata socket read error for %s: %s", c->name, sockstrerror(sockerrno));