Zero bufofs in connector loop for completeness and make sure to retry if there is more data to read
This commit is contained in:
parent
53641a9c24
commit
70393442a3
@ -237,9 +237,10 @@ reparse:
|
||||
return;
|
||||
}
|
||||
memcpy(msg, client->buf, buflen);
|
||||
msg[buflen] = 0;
|
||||
msg[buflen] = '\0';
|
||||
client->bufofs -= buflen;
|
||||
memmove(client->buf, client->buf + buflen, client->bufofs);
|
||||
client->buf[client->bufofs] = '\0';
|
||||
if (!(val = json_loads(msg, 0, NULL))) {
|
||||
char *buf = strdup("Invalid JSON, disconnecting\n");
|
||||
|
||||
@ -270,6 +271,8 @@ reparse:
|
||||
|
||||
if (client->bufofs)
|
||||
goto reparse;
|
||||
if (moredata)
|
||||
goto retry;
|
||||
}
|
||||
|
||||
/* Waits on fds ready to read on from the list stored in conn_instance and
|
||||
|
||||
Loading…
Reference in New Issue
Block a user