Patchwork eloop/poll: Handle POLLER | POLLHUP in read logic.

login
register
mail settings
Submitter Ben Greear
Date March 30, 2012, 9:35 p.m.
Message ID <1333143304-27495-1-git-send-email-greearb@candelatech.com>
Download mbox | patch
Permalink /patch/149758/
State Accepted
Commit f115560c21db876be8a6272f389c02034eccbdcb
Headers show

Comments

Ben Greear - March 30, 2012, 9:35 p.m.
From: Ben Greear <greearb@candelatech.com>

Without this, we can get into a tight loop because the
code in general doesn't add eloop exception handlers,
so socket reporting the POLLERR would never be read.

With this change, any socket with POLLERR or POLLHUP
asserted will be handled by the read logic.

Signed-hostap: Ben Greear <greearb@candelatech.com>
---
:100644 100644 5691f15... 9f64314... M	src/utils/eloop.c
 src/utils/eloop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Jouni Malinen - June 24, 2012, 10:20 a.m.
On Fri, Mar 30, 2012 at 02:35:04PM -0700, greearb@candelatech.com wrote:
> Without this, we can get into a tight loop because the
> code in general doesn't add eloop exception handlers,
> so socket reporting the POLLERR would never be read.
> 
> With this change, any socket with POLLERR or POLLHUP
> asserted will be handled by the read logic.

Thanks, applied.

Patch

diff --git a/src/utils/eloop.c b/src/utils/eloop.c
index 5691f15..9f64314 100644
--- a/src/utils/eloop.c
+++ b/src/utils/eloop.c
@@ -350,7 +350,7 @@  static void eloop_sock_table_dispatch(struct eloop_sock_table *readers,
 				      int max_pollfd_map)
 {
 	if (eloop_sock_table_dispatch_table(readers, pollfds_map,
-					    max_pollfd_map, POLLIN))
+					    max_pollfd_map, POLLIN | POLLERR | POLLHUP))
 		return; /* pollfds may be invalid at this point */
 
 	if (eloop_sock_table_dispatch_table(writers, pollfds_map,