From: Howard Chu Date: Wed, 8 Dec 2004 03:47:48 +0000 (+0000) Subject: ITS#3422, restore original select() behavior X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~98 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0eab783e6a5994df12e1c1d227a746ac3a925e4a;p=openldap ITS#3422, restore original select() behavior --- diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index a4e3124ed9..625747e924 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -1729,19 +1729,16 @@ slapd_daemon_task( /* FALL THRU */ } - /* We don't need to examine the event status for wake_sds; - * if waking is set and we woke up, we'll read whatever - * we can. - */ - if ( waking ) { +#if SLAP_EVENTS_ARE_INDEXED + if ( SLAP_EVENT_IS_READ( wake_sds[0] )) { char c[BUFSIZ]; tcp_read( wake_sds[0], c, sizeof(c) ); waking = 0; ns--; + SLAP_EVENT_CLR_READ( wake_sds[0] ); continue; } -#if SLAP_EVENTS_ARE_INDEXED /* The event slot equals the descriptor number - this is * true for Unix select and poll. We treat Windows select * like this too, even though it's a kludge. @@ -1883,12 +1880,23 @@ slapd_daemon_task( * all other connections last (as we do for select), we would need * to use multiple event handles and cascade them. * - * That seems like a bit of hassle. So the wake_sds check has moved - * above. For epoll and kqueue we can associate arbitrary data with + * That seems like a bit of hassle. So the wake_sds check has been + * skipped. For epoll and kqueue we can associate arbitrary data with * 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. */ + /* 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 );