]> git.sur5r.net Git - openldap/commitdiff
Fix ITS#4790, prev patch was corrupted
authorHoward Chu <hyc@openldap.org>
Sun, 24 Dec 2006 19:05:13 +0000 (19:05 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 24 Dec 2006 19:05:13 +0000 (19:05 +0000)
servers/slapd/connection.c

index fc0ebed127cb71edb58e182ca8918c51675f6148..de06ffb7c9b2d48d95730d507bcc9c2f921c9d14 100644 (file)
@@ -196,21 +196,22 @@ int connections_shutdown(void)
        ber_socket_t i;
 
        for ( i = 0; i < dtblsize; i++ ) {
-               ldap_pvt_thread_mutex_lock( &connections[i].c_mutex );
-               if( connections[i].c_struct_state == SLAP_C_USED ) {
-
-                       /* give persistent clients a chance to cleanup */
-                       if( connections[i].c_conn_state == SLAP_C_CLIENT ) {
-                               ldap_pvt_thread_pool_submit( &connection_pool,
-                               connections[i].c_clientfunc, connections[i].c_clientarg );
-                               continue;
-                       } else {
-                               /* c_mutex is locked */
-                               connection_closing( &connections[i], "slapd shutdown" );
-                               connection_close( &connections[i] );
+               if( connections[i].c_struct_state != SLAP_C_UNINITIALIZED ) {
+                       ldap_pvt_thread_mutex_lock( &connections[i].c_mutex );
+                       if( connections[i].c_struct_state == SLAP_C_USED ) {
+
+                               /* give persistent clients a chance to cleanup */
+                               if( connections[i].c_conn_state == SLAP_C_CLIENT ) {
+                                       ldap_pvt_thread_pool_submit( &connection_pool,
+                                       connections[i].c_clientfunc, connections[i].c_clientarg );
+                               } else {
+                                       /* c_mutex is locked */
+                                       connection_closing( &connections[i], "slapd shutdown" );
+                                       connection_close( &connections[i] );
+                               }
                        }
+                       ldap_pvt_thread_mutex_unlock( &connections[i].c_mutex );
                }
-               ldap_pvt_thread_mutex_unlock( &connections[i].c_mutex );
        }
 
        return 0;