Browse Source

Reinstate checking for zero as a return from recv for cleanly disconnected clients

master
Con Kolivas 10 years ago
parent
commit
bf72ebbee6
  1. 5
      src/connector.c

5
src/connector.c

@ -335,8 +335,9 @@ retry:
buflen = PAGESIZE - client->bufofs; buflen = PAGESIZE - client->bufofs;
ret = recv(client->fd, client->buf + client->bufofs, buflen, 0); ret = recv(client->fd, client->buf + client->bufofs, buflen, 0);
if (ret < 1) { if (ret < 1) {
if (!ret) /* We should have something to read if called since poll set
return; * this fd's revents status so if there's nothing it means the
* client has disconnected. */
LOGINFO("Client fd %d disconnected - recv fail with bufofs %d ret %d errno %d %s", LOGINFO("Client fd %d disconnected - recv fail with bufofs %d ret %d errno %d %s",
client->fd, client->bufofs, ret, errno, ret && errno ? strerror(errno) : ""); client->fd, client->bufofs, ret, errno, ret && errno ? strerror(errno) : "");
invalidate_client(ckp, cdata, client); invalidate_client(ckp, cdata, client);

Loading…
Cancel
Save