]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/connection.c
Fix prev commit, renaming schema
[openldap] / servers / slapd / connection.c
index 7a46410ab55aac83e35ef20b7dab8911e2af10b7..c64ef4866ed2ffadf5d3398636c49ac6894fdbc3 100644 (file)
@@ -196,20 +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 );
-                       } 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;
@@ -303,10 +305,10 @@ static Connection* connection_get( ber_socket_t s )
        if( c != NULL ) {
                ber_socket_t    sd;
 
-               assert( c->c_struct_state != SLAP_C_UNINITIALIZED );
-
                ldap_pvt_thread_mutex_lock( &c->c_mutex );
 
+               assert( c->c_struct_state != SLAP_C_UNINITIALIZED );
+
                ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
                if( c->c_struct_state != SLAP_C_USED ) {
                        /* connection must have been closed due to resched */