]> git.meshlink.io Git - meshlink/blobdiff - src/meta.c
Fixed error logging on "Input buffer full" condition.
[meshlink] / src / meta.c
index cf6b9d446d82067ee3739afdbecd25bce1247313..849a0c6947a409807c396bf769c28567d5aa4360 100644 (file)
@@ -85,10 +85,10 @@ bool receive_meta(connection_t *c) {
           - If not, keep stuff in buffer and exit.
         */
 
-       buffer_compact(&c->inbuf);
+       buffer_compact(&c->inbuf, MAXBUFSIZE);
 
        if(sizeof inbuf <= c->inbuf.len) {
-               logger(LOG_ERR, "Input buffer full for %s (%s)\n");
+               logger(LOG_ERR, "Input buffer full for %s (%s)", c->name, c->hostname);
                return false;
        }
 
@@ -137,6 +137,7 @@ bool receive_meta(connection_t *c) {
                        if(c->tcplen) {
                                char *tcpbuffer = buffer_read(&c->inbuf, c->tcplen);
                                if(tcpbuffer) {
+                                       c->tcplen = 0;
                                        receive_tcppacket(c, tcpbuffer, c->tcplen);
                                        continue;
                                } else {