mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
Add Debug to help sort out race condition.
This commit is contained in:
parent
368628e9d5
commit
35eff96dad
1 changed files with 16 additions and 8 deletions
|
|
@ -142,7 +142,11 @@ static Connection* connection_get( int s )
|
||||||
{
|
{
|
||||||
/* connections_mutex should be locked by caller */
|
/* connections_mutex should be locked by caller */
|
||||||
|
|
||||||
Connection *c = NULL;
|
Connection *c;
|
||||||
|
|
||||||
|
Debug( LDAP_DEBUG_ARGS,
|
||||||
|
"connection_get(%d)\n",
|
||||||
|
s, 0, 0 );
|
||||||
|
|
||||||
assert( connections != NULL );
|
assert( connections != NULL );
|
||||||
|
|
||||||
|
|
@ -151,12 +155,17 @@ static Connection* connection_get( int s )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_WINSOCK
|
#ifndef HAVE_WINSOCK
|
||||||
assert( connections[s].c_struct_state == SLAP_C_USED );
|
|
||||||
assert( connections[s].c_conn_state != SLAP_C_INVALID );
|
|
||||||
assert( ber_pvt_sb_in_use( connections[s].c_sb ) );
|
|
||||||
|
|
||||||
c = &connections[s];
|
c = &connections[s];
|
||||||
|
|
||||||
|
assert( c->c_struct_state == SLAP_C_USED );
|
||||||
|
|
||||||
|
ldap_pvt_thread_mutex_lock( &c->c_mutex );
|
||||||
|
|
||||||
|
assert( c->c_conn_state != SLAP_C_INVALID );
|
||||||
|
assert( ber_pvt_sb_in_use( c->c_sb ) );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
c = NULL;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -179,6 +188,7 @@ static Connection* connection_get( int s )
|
||||||
|
|
||||||
if( ber_pvt_sb_get_desc( connections[i].c_sb ) == s ) {
|
if( ber_pvt_sb_get_desc( connections[i].c_sb ) == s ) {
|
||||||
c = &connections[i];
|
c = &connections[i];
|
||||||
|
ldap_pvt_thread_mutex_lock( &c->c_mutex );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -186,12 +196,10 @@ static Connection* connection_get( int s )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( c != NULL ) {
|
if( c != NULL ) {
|
||||||
/* we do this BEFORE locking to aid in debugging */
|
/* we do this AFTER locking to aid in debugging */
|
||||||
Debug( LDAP_DEBUG_TRACE,
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
"connection_get(%d): got connid=%ld\n",
|
"connection_get(%d): got connid=%ld\n",
|
||||||
s, c->c_connid, 0 );
|
s, c->c_connid, 0 );
|
||||||
|
|
||||||
ldap_pvt_thread_mutex_lock( &c->c_mutex );
|
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue