]> git.sur5r.net Git - openldap/commitdiff
Remove check for inactive streams before connection_read/_write
authorKurt Zeilenga <kurt@openldap.org>
Mon, 14 Jun 1999 20:28:30 +0000 (20:28 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 14 Jun 1999 20:28:30 +0000 (20:28 +0000)
calls.  Such checks are ineffective it protecting connection_read/_write
from being called inactive streams.  connection_read/_write have their
own protection against such (in connection_get()).

servers/slapd/daemon.c

index 83774c8abb7f22b6120d01b80ce44fe7e41fd7ed..932e36babfdb5e48406fb177a4276272d02206d4 100644 (file)
@@ -553,17 +553,12 @@ slapd_daemon_task(
                                "daemon: write active on %d\n",
                                wd, 0, 0 );
 
-                       ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
-                       active = FD_ISSET( wd, &slap_daemon.sd_actives );
-                       ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
-
-                       if( ! active ) {
-                               /* descriptor no longer in FD set, should be closed */
-                               Debug( LDAP_DEBUG_CONNS,
-                                       "daemon: write %d inactive, closing.\n", wd, 0, 0 );
-                               slapd_close( wd );
-                               continue;
-                       }
+                       /*
+                        * NOTE: it is possible that the connection was closed
+                        * and that the stream is now inactive.
+                        * connection_write() must valid the stream is still
+                        * active.
+                        */
 
                        if ( connection_write( wd ) < 0 ) {
                                FD_CLR( (unsigned) wd, &readfds );
@@ -595,17 +590,13 @@ slapd_daemon_task(
                        Debug ( LDAP_DEBUG_CONNS,
                                "daemon: read activity on %d\n", rd, 0, 0 );
 
-                       ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
-                       active = FD_ISSET( rd, &slap_daemon.sd_actives );
-                       ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
 
-                       if( ! active ) {
-                               /* descriptor no longer in FD set, should be closed */
-                               Debug( LDAP_DEBUG_CONNS,
-                                       "daemon: read %d inactive, closing.\n", rd, 0, 0 );
-                               slapd_close( rd );
-                               continue;
-                       }
+                       /*
+                        * NOTE: it is possible that the connection was closed
+                        * and that the stream is now inactive.
+                        * connection_read() must valid the stream is still
+                        * active.
+                        */
 
                        if ( connection_read( rd ) < 0 ) {
                                slapd_close( rd );