]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/connection.c
use mutex to protect connection in connection_destroy until task is complete
[openldap] / servers / slapd / connection.c
index 322c44d597362441a115da13ac8482e550e8a549..b7ed2d7d62d19f15da87bdf985f0493e8dfb106e 100644 (file)
@@ -322,6 +322,7 @@ connection_destroy( Connection *c )
     assert( c->c_conn_state != SLAP_C_INVALID );
     assert( c->c_ops == NULL );
 
+       ldap_pvt_thread_mutex_lock( &connections_mutex );
     c->c_struct_state = SLAP_C_UNUSED;
     c->c_conn_state = SLAP_C_INVALID;
 
@@ -359,6 +360,7 @@ connection_destroy( Connection *c )
        }
 
        lber_pvt_sb_destroy( &c->c_sb );
+       ldap_pvt_thread_mutex_unlock( &connections_mutex );
 }
 
 int connection_state_closing( Connection *c )