]> git.sur5r.net Git - openldap/commitdiff
ITS#4338 delete extraneous slapd_close() calls. Descriptors that were in
authorHoward Chu <hyc@openldap.org>
Fri, 13 Jan 2006 17:30:03 +0000 (17:30 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 13 Jan 2006 17:30:03 +0000 (17:30 +0000)
the event set must be removed using slapd_remove() and the whole sequence
must be protected with the slap_daemon.sd_mutex to close them properly.
Otherwise it will wind up closing valid, freshly opened sockets, or closing
dead sockets twice, etc. It's unnecessary to do any close management here
since connection.c already does the correct teardown sequence.

servers/slapd/daemon.c

index e6b5e157cb15da24fc61717b9c864d0980152b31..dbfcd43cbe066f80bc2b8007dbfbe3be4e8afa71 100644 (file)
@@ -1980,13 +1980,15 @@ slapd_daemon_task(
                         * and that the stream is now inactive.
                         * connection_write() must validate the stream is still
                         * active.
+                        *
+                        * ITS#4338: if the stream is invalid, there is no need to
+                        * close it here. It has already been closed in connection.c.
                         */
                        if ( connection_write( wd ) < 0 ) {
                                if ( SLAP_EVENT_IS_READ( wd )) {
                                        SLAP_EVENT_CLR_READ( (unsigned) wd );
                                        nrfds--;
                                }
-                               slapd_close( wd );
                        }
 #endif
                }
@@ -2014,9 +2016,7 @@ slapd_daemon_task(
 #ifdef SLAP_LIGHTWEIGHT_DISPATCHER
                        connection_read_activate( rd );
 #else
-                       if ( connection_read( rd ) < 0 ) {
-                               slapd_close( rd );
-                       }
+                       connection_read( rd );
 #endif
                }
 #else  /* !SLAP_EVENTS_ARE_INDEXED */
@@ -2106,7 +2106,6 @@ slapd_daemon_task(
                                         * active.
                                         */
                                        if ( connection_write( fd ) < 0 ) {
-                                               slapd_close( fd );
                                                continue;
                                        }
 #endif
@@ -2125,7 +2124,7 @@ slapd_daemon_task(
                                         * connection_read() must valid the stream is still
                                         * active.
                                         */
-                                       if ( connection_read( fd ) < 0 ) slapd_close( fd );
+                                       connection_read( fd );
 #endif
                                }
                        }