#endif /* LDAP_DEBUG */
 
                for ( i = 0; i < ns; i++ ) {
-                       int rc = 1, fd;
+                       int rc = 1, fd, w = 0;
 
                        if ( SLAP_EVENT_IS_LISTENER( i ) ) {
                                rc = slap_listener_activate( SLAP_EVENT_LISTENER( i ) );
                                                fd, 0, 0 );
 
                                        SLAP_EVENT_CLR_WRITE( i );
+                                       w = 1;
 
                                        /*
                                         * NOTE: it is possible that the connection was closed
 
                                        SLAP_EVENT_CLR_READ( i );
                                        connection_read_activate( fd );
-                               } else {
+                               } else if ( !w ) {
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: hangup on %d\n", fd, 0, 0 );
                                        connection_hangup( fd );