From 98969cc28e5298da31c9f3d6830d021676fa3c08 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 30 Oct 2005 00:50:59 +0000 Subject: [PATCH] Fix epoll, just handle wake events in the order they arrived. --- servers/slapd/daemon.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 4adc2345ed..2caed7fed8 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -2025,18 +2025,10 @@ slapd_daemon_task( * an event, so we could use pointers to the listener structure * instead of just the file descriptor. For /dev/poll we have to * search the listeners array for a matching descriptor. + * + * We now handle wake events when we see them; they are not given + * higher priority. */ - /* if waking is set and we woke up, we'll read whatever - * we can. - */ - if ( waking ) { - char c[BUFSIZ]; - tcp_read( wake_sds[0], c, sizeof(c) ); - waking = 0; - ns--; - continue; - } - #ifdef LDAP_DEBUG Debug( LDAP_DEBUG_CONNS, "daemon: activity on:", 0, 0, 0 ); @@ -2084,8 +2076,13 @@ slapd_daemon_task( if ( rc ) { fd = SLAP_EVENT_FD( i ); - /* Ignore wake events, they were handled above */ - if ( fd == wake_sds[0] ) continue; + /* Handle wake events */ + if ( fd == wake_sds[0] ) { + char c[BUFSIZ]; + tcp_read( wake_sds[0], c, sizeof(c) ); + waking = 0; + break; + } if( SLAP_EVENT_IS_WRITE( i ) ) { Debug( LDAP_DEBUG_CONNS, -- 2.39.5