}
ldap_pvt_thread_mutex_lock( &connections[i].c_mutex );
+
+ /* connections_mutex and c_mutex are locked */
connection_closing( &connections[i] );
connection_close( &connections[i] );
+
ldap_pvt_thread_mutex_unlock( &connections[i].c_mutex );
}
case LDAP_REQ_UNBIND_30:
#endif
case LDAP_REQ_UNBIND:
+ /* c_mutex is locked */
connection_closing( conn );
break;
}
}
- if( conn->c_conn_state == SLAP_C_CLOSING ) {
- Debug( LDAP_DEBUG_TRACE,
- "connection_operation: attempting closing conn=%ld sd=%d.\n",
- conn->c_connid, ber_pvt_sb_get_desc( conn->c_sb ), 0 );
-
- connection_close( conn );
- }
-
ldap_pvt_thread_mutex_lock( &active_threads_mutex );
active_threads--;
if( active_threads < 1 ) {
ldap_pvt_thread_mutex_lock( &connections_mutex );
+ /* get (locked) connection */
c = connection_get( s );
+
if( c == NULL ) {
Debug( LDAP_DEBUG_ANY,
"connection_read(%d): no connection!\n",
"connection_read(%d): input error=%d id=%ld, closing.\n",
s, rc, c->c_connid );
+ /* connections_mutex and c_mutex are locked */
connection_closing( c );
connection_close( c );
}
{
Operation *op;
+ if( conn->c_conn_state == SLAP_C_CLOSING ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "connection_resched: attempting closing conn=%ld sd=%d.\n",
+ conn->c_connid, ber_pvt_sb_get_desc( conn->c_sb ), 0 );
+
+ connection_close( conn );
+ return 0;
+ }
+
if( conn->c_conn_state != SLAP_C_ACTIVE ) {
/* other states need different handling */
return 0;