Browse Source

Explicitly check for EPOLLRDHUP as well

master
Con Kolivas 10 years ago
parent
commit
e012108280
  1. 4
      src/connector.c

4
src/connector.c

@ -225,7 +225,7 @@ static int accept_client(cdata_t *cdata, const int epfd, const uint64_t server)
client->fd = fd; client->fd = fd;
event.data.ptr = client; event.data.ptr = client;
event.events = EPOLLIN; event.events = EPOLLIN | EPOLLRDHUP;
if (unlikely(epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &event) < 0)) { if (unlikely(epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &event) < 0)) {
LOGERR("Failed to epoll_ctl add in accept_client"); LOGERR("Failed to epoll_ctl add in accept_client");
recycle_client(cdata, client); recycle_client(cdata, client);
@ -495,7 +495,7 @@ void *receiver(void *arg)
client = ref_client_by_id(cdata, client->id); client = ref_client_by_id(cdata, client->id);
if (unlikely(!client)) if (unlikely(!client))
continue; continue;
if ((event.events & EPOLLERR) || (event.events & EPOLLHUP)) { if (event.events & (EPOLLERR | EPOLLHUP | EPOLLRDHUP)) {
/* Client disconnected */ /* Client disconnected */
LOGDEBUG("Client fd %d HUP in epoll", client->fd); LOGDEBUG("Client fd %d HUP in epoll", client->fd);
invalidate_client(cdata->pi->ckp, cdata, client); invalidate_client(cdata->pi->ckp, cdata, client);

Loading…
Cancel
Save