X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fconnection.c;h=6afc81bbc6d3bfeb961f5b5960105ac8fba8c19d;hb=2bfe79fe884565801600e309d1fcbefa41fb0f4b;hp=367ddf209eb0aacec61ffc425de09f5a8f3f740f;hpb=0d2e2772d52d958880837f8191f1c73473c37e97;p=openldap diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 367ddf209e..6afc81bbc6 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -829,9 +829,15 @@ void connection_closing( Connection *c, const char *why ) connection_abandon( c ); /* wake write blocked operations */ - slapd_clr_write( sd, 1 ); if ( c->c_writewaiter ) { ldap_pvt_thread_cond_signal( &c->c_write_cv ); + ldap_pvt_thread_mutex_unlock( &c->c_mutex ); + slapd_clr_write( sd, 1 ); + ldap_pvt_thread_mutex_lock( &c->c_write_mutex ); + ldap_pvt_thread_mutex_lock( &c->c_mutex ); + ldap_pvt_thread_mutex_unlock( &c->c_write_mutex ); + } else { + slapd_clr_write( sd, 1 ); } } else if( why == NULL && c->c_close_reason == conn_lost_str ) { @@ -914,9 +920,14 @@ Connection* connection_next( Connection *c, ber_socket_t *index ) ldap_pvt_thread_mutex_lock( &connections_mutex ); for(; *index < dtblsize; (*index)++) { + int c_struct; if( connections[*index].c_struct_state == SLAP_C_UNINITIALIZED ) { assert( connections[*index].c_conn_state == SLAP_C_INVALID ); +#ifdef HAVE_WINSOCK break; +#else + continue; +#endif } if( connections[*index].c_struct_state == SLAP_C_USED ) { @@ -936,7 +947,10 @@ Connection* connection_next( Connection *c, ber_socket_t *index ) break; } - assert( connections[*index].c_struct_state == SLAP_C_UNUSED ); + c_struct = connections[*index].c_struct_state; + if ( c_struct == SLAP_C_PENDING ) + continue; + assert( c_struct == SLAP_C_UNUSED ); assert( connections[*index].c_conn_state == SLAP_C_INVALID ); }