ITS#9831 Advance connections[index] correctly

This commit is contained in:
Ondřej Kuzník 2022-04-25 16:53:25 +01:00 committed by Quanah Gibson-Mount
parent 47069fee55
commit 15573c72fc

View file

@ -871,13 +871,14 @@ Connection* connection_next( Connection *c, ber_socket_t *index )
for(; *index < dtblsize; (*index)++) { for(; *index < dtblsize; (*index)++) {
if( connections[*index].c_sb ) { if( connections[*index].c_sb ) {
c = &connections[(*index)++]; c = &connections[*index];
ldap_pvt_thread_mutex_lock( &c->c_mutex ); ldap_pvt_thread_mutex_lock( &c->c_mutex );
if ( c->c_conn_state == SLAP_C_INVALID ) { if ( c->c_conn_state == SLAP_C_INVALID ) {
ldap_pvt_thread_mutex_unlock( &c->c_mutex ); ldap_pvt_thread_mutex_unlock( &c->c_mutex );
c = NULL; c = NULL;
continue; continue;
} }
(*index)++;
break; break;
} }
} }