Browse Source

Check for correct condition in wait_close

master
Con Kolivas 10 years ago
parent
commit
85b17f1b78
  1. 8
      src/libckpool.c

8
src/libckpool.c

@ -914,14 +914,18 @@ out:
int wait_close(int sockd, int timeout) int wait_close(int sockd, int timeout)
{ {
struct pollfd sfd; struct pollfd sfd;
int ret;
if (unlikely(sockd < 0)) if (unlikely(sockd < 0))
return -1; return -1;
sfd.fd = sockd; sfd.fd = sockd;
sfd.events = POLLHUP; sfd.events = POLLIN;
sfd.revents = 0; sfd.revents = 0;
timeout *= 1000; timeout *= 1000;
return poll(&sfd, 1, timeout); ret = poll(&sfd, 1, timeout);
if (ret < 1)
return 0;
return sfd.revents & POLLHUP;
} }
/* Emulate a select read wait for high fds that select doesn't support */ /* Emulate a select read wait for high fds that select doesn't support */

Loading…
Cancel
Save