Log message:
Hopefully correct a condition that can cause the server to chew CPU by not
clearing a particular fd--POLLHUP was not being caught. Please test to see
if this fixes the problem!
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@529
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
+2001-07-11 Kevin L. Mitchell <klmitch@mit.edu>
+
+ * ircd/engine_poll.c: deal with POLLHUP properly (hopefully)
+
+ * ircd/engine_devpoll.c: deal with POLLHUP properly (hopefully)
+
2001-07-09 Kevin L. Mitchell <klmitch@mit.edu>
* ircd/os_bsd.c (os_get_rusage): move buf into the two ifdef'd
# define POLLWRITEFLAGS POLLWRNORM
#endif
-/* Figure out what bits indicate errors */
-#ifdef POLLHUP
-# define POLLERRORS (POLLHUP|POLLERR)
-#else
-# define POLLERRORS POLLERR
-#endif
-
static struct Socket** sockList;
static int devpoll_max;
static int devpoll_fd;
}
}
+ assert(!(polls[i].revents & POLLERR));
+
+#ifdef POLLHUP
+ if (polls[i].revents & POLLHUP) { /* hang-up on socket */
+ Debug((DEBUG_ENGINE, "devpoll: EOF from client (POLLHUP)"));
+ event_generate(ET_EOF, sock, 0);
+ nfds--;
+ continue;
+ }
+#endif /* POLLHUP */
+
switch (s_state(sock)) {
case SS_CONNECTING:
if (polls[i].revents & POLLWRITEFLAGS) { /* connection completed */
# define POLLWRITEFLAGS POLLWRNORM
#endif
-/* Figure out what bits indicate errors */
-#ifdef POLLHUP
-# define POLLERRORS (POLLHUP|POLLERR)
-#else
-# define POLLERRORS POLLERR
-#endif
-
static struct Socket** sockList;
static struct pollfd* pollfdList;
static unsigned int poll_count;
}
}
+ assert(!(pollfdList[i].revents & POLLERR));
+
+#ifdef POLLHUP
+ if (pollfdList[i].revents & POLLHUP) { /* hang-up on socket */
+ Debug((DEBUG_ENGINE, "poll: EOF from client (POLLHUP)"));
+ event_generate(ET_EOF, sock, 0);
+ nfds--;
+ continue;
+ }
+#endif /* POLLHUP */
+
switch (s_state(sock)) {
case SS_CONNECTING:
if (pollfdList[i].revents & POLLWRITEFLAGS) { /* connect completed */