Add buf offset to disconnect message and reset flags on looping
This commit is contained in:
parent
a493539a75
commit
2d6d982bb1
@ -186,8 +186,8 @@ static void send_client(conn_instance_t *ci, int64_t id, char *buf);
|
||||
static void parse_client_msg(conn_instance_t *ci, client_instance_t *client)
|
||||
{
|
||||
ckpool_t *ckp = ci->pi->ckp;
|
||||
int buflen, ret, flags = 0;
|
||||
char msg[PAGESIZE], *eol;
|
||||
int buflen, ret, flags;
|
||||
bool moredata = false;
|
||||
json_t *val;
|
||||
|
||||
@ -195,6 +195,8 @@ retry:
|
||||
buflen = PAGESIZE - client->bufofs;
|
||||
if (moredata)
|
||||
flags = MSG_DONTWAIT;
|
||||
else
|
||||
flags = 0;
|
||||
ret = recv(client->fd, client->buf + client->bufofs, buflen, flags);
|
||||
if (ret < 1) {
|
||||
/* Nothing else ready to be read */
|
||||
@ -204,8 +206,8 @@ retry:
|
||||
/* We should have something to read if called since poll set
|
||||
* this fd's revents status so if there's nothing it means the
|
||||
* client has disconnected. */
|
||||
LOGINFO("Client fd %d disconnected with ret %d errno %d %s", client->fd,
|
||||
ret, errno, errno ? strerror(errno) : "");
|
||||
LOGINFO("Client fd %d disconnected with bufofs %d ret %d errno %d %s",
|
||||
client->fd, client->bufofs, ret, errno, errno ? strerror(errno) : "");
|
||||
invalidate_client(ckp, ci, client);
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user