mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
Straighten up client pending op tracking
This commit is contained in:
parent
dc1961cb15
commit
f832024e90
3 changed files with 19 additions and 3 deletions
|
|
@ -244,6 +244,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
|
|||
}
|
||||
|
||||
tavl_delete( &client->c_ops, op, operation_client_cmp );
|
||||
client->c_n_ops_executing--;
|
||||
|
||||
client_reset( client );
|
||||
|
||||
|
|
@ -326,6 +327,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
|
|||
|
||||
rc = tavl_insert( &client->c_ops, op, operation_client_cmp, avl_dup_error );
|
||||
assert( rc == LDAP_SUCCESS );
|
||||
client->c_n_ops_executing++;
|
||||
CONNECTION_UNLOCK(client);
|
||||
|
||||
if ( pin ) {
|
||||
|
|
@ -663,6 +665,7 @@ handle_bind_response(
|
|||
assert( !removed || op == removed );
|
||||
|
||||
if ( client->c_state == LLOAD_C_BINDING ) {
|
||||
assert( removed );
|
||||
switch ( result ) {
|
||||
case LDAP_SASL_BIND_IN_PROGRESS:
|
||||
op->o_saved_msgid = op->o_client_msgid;
|
||||
|
|
@ -676,6 +679,7 @@ handle_bind_response(
|
|||
client->c_state = LLOAD_C_READY;
|
||||
client->c_type = LLOAD_C_OPEN;
|
||||
client->c_pin_id = 0;
|
||||
client->c_n_ops_executing--;
|
||||
if ( !BER_BVISNULL( &client->c_auth ) ) {
|
||||
if ( result != LDAP_SUCCESS ) {
|
||||
ber_memfree( client->c_auth.bv_val );
|
||||
|
|
@ -693,6 +697,9 @@ handle_bind_response(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if ( removed ) {
|
||||
client->c_n_ops_executing--;
|
||||
}
|
||||
assert( client->c_state == LLOAD_C_DYING ||
|
||||
client->c_state == LLOAD_C_CLOSING );
|
||||
}
|
||||
|
|
@ -783,6 +790,9 @@ handle_whoami_response(
|
|||
removed = tavl_delete( &client->c_ops, op, operation_client_cmp );
|
||||
assert( !removed || op == removed );
|
||||
op->o_pin_id = 0;
|
||||
if ( removed ) {
|
||||
client->c_n_ops_executing--;
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "handle_whoami_response: "
|
||||
"connid=%ld new authid=%s\n",
|
||||
|
|
|
|||
|
|
@ -445,9 +445,12 @@ void
|
|||
client_reset( LloadConnection *c )
|
||||
{
|
||||
TAvlnode *root;
|
||||
long freed = 0, executing;
|
||||
|
||||
root = c->c_ops;
|
||||
c->c_ops = NULL;
|
||||
executing = c->c_n_ops_executing;
|
||||
c->c_n_ops_executing = 0;
|
||||
|
||||
if ( !BER_BVISNULL( &c->c_auth ) ) {
|
||||
ch_free( c->c_auth.bv_val );
|
||||
|
|
@ -460,12 +463,12 @@ client_reset( LloadConnection *c )
|
|||
CONNECTION_UNLOCK(c);
|
||||
|
||||
if ( root ) {
|
||||
int freed;
|
||||
freed = tavl_free( root, (AVL_FREE)operation_abandon );
|
||||
Debug( LDAP_DEBUG_TRACE, "client_reset: "
|
||||
"dropped %d operations\n",
|
||||
"dropped %ld operations\n",
|
||||
freed );
|
||||
}
|
||||
assert( freed == executing );
|
||||
|
||||
CONNECTION_LOCK(c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,12 +32,15 @@ int
|
|||
handle_starttls( LloadConnection *c, LloadOperation *op )
|
||||
{
|
||||
struct event_base *base = event_get_base( c->c_read_event );
|
||||
LloadOperation *found;
|
||||
BerElement *output;
|
||||
char *msg = NULL;
|
||||
int rc = LDAP_SUCCESS;
|
||||
|
||||
CONNECTION_LOCK(c);
|
||||
tavl_delete( &c->c_ops, op, operation_client_cmp );
|
||||
found = tavl_delete( &c->c_ops, op, operation_client_cmp );
|
||||
assert( op == found );
|
||||
c->c_n_ops_executing--;
|
||||
|
||||
if ( c->c_is_tls == LLOAD_TLS_ESTABLISHED ) {
|
||||
rc = LDAP_OPERATIONS_ERROR;
|
||||
|
|
|
|||
Loading…
Reference in a new issue