mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-02-23 14:09:39 +08:00
Manage connection refcnt better
This commit is contained in:
parent
af7ce80c85
commit
37cff37305
@ -111,7 +111,10 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
|
||||
"suspended read event on connid=%lu\n",
|
||||
c->c_connid );
|
||||
|
||||
CONNECTION_UNLOCK(c);
|
||||
/* We have scheduled a call to handle_requests which takes care of
|
||||
* handling further requests, just make sure the connection sticks around
|
||||
* for that */
|
||||
CONNECTION_UNLOCK_INCREF(c);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -121,7 +124,7 @@ handle_requests( void *ctx, void *arg )
|
||||
Connection *c = arg;
|
||||
int requests_handled = 0;
|
||||
|
||||
CONNECTION_LOCK(c);
|
||||
CONNECTION_LOCK_DECREF(c);
|
||||
for ( ; requests_handled < slap_conn_max_pdus_per_cycle;
|
||||
requests_handled++ ) {
|
||||
BerElement *ber;
|
||||
|
@ -237,7 +237,7 @@ operation_destroy_from_client( Operation *op )
|
||||
ldap_pvt_thread_mutex_unlock( &op->o_mutex );
|
||||
|
||||
assert( upstream != NULL );
|
||||
CONNECTION_UNLOCK(upstream);
|
||||
UPSTREAM_UNLOCK_OR_DESTROY(upstream);
|
||||
CONNECTION_LOCK_DECREF(client);
|
||||
return;
|
||||
}
|
||||
@ -381,7 +381,7 @@ operation_destroy_from_upstream( Operation *op )
|
||||
ldap_pvt_thread_mutex_unlock( &op->o_mutex );
|
||||
|
||||
assert( client != NULL );
|
||||
CONNECTION_UNLOCK(client);
|
||||
CLIENT_UNLOCK_OR_DESTROY(client);
|
||||
CONNECTION_LOCK_DECREF(upstream);
|
||||
return;
|
||||
}
|
||||
@ -743,11 +743,13 @@ fail:
|
||||
if ( upstream ) {
|
||||
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
|
||||
CONNECTION_LOCK_DECREF(upstream);
|
||||
upstream->c_n_ops_executing--;
|
||||
UPSTREAM_UNLOCK_OR_DESTROY(upstream);
|
||||
operation_send_reject( op, LDAP_OTHER, "internal error", 0 );
|
||||
}
|
||||
CONNECTION_LOCK_DECREF(client);
|
||||
op->o_client_refcnt--;
|
||||
operation_destroy_from_client( op );
|
||||
return rc;
|
||||
CLIENT_UNLOCK_OR_DESTROY(client);
|
||||
return -1;
|
||||
}
|
||||
|
@ -922,9 +922,11 @@ upstream_destroy( Connection *c )
|
||||
root = c->c_ops;
|
||||
c->c_ops = NULL;
|
||||
executing = c->c_n_ops_executing;
|
||||
c->c_n_ops_executing = 0;
|
||||
|
||||
read_event = c->c_read_event;
|
||||
write_event = c->c_write_event;
|
||||
|
||||
CONNECTION_UNLOCK_INCREF(c);
|
||||
|
||||
freed = tavl_free( root, (AVL_FREE)operation_lost_upstream );
|
||||
|
Loading…
Reference in New Issue
Block a user