Keep a reference around for the bind task

This commit is contained in:
Ondřej Kuzník 2018-03-28 10:16:24 +01:00
parent 0314f95d7f
commit b039e7c1b0
2 changed files with 3 additions and 8 deletions

View file

@ -1432,13 +1432,7 @@ backend_conn_cb( ldap_pvt_thread_start_t *start, void *startarg, void *arg )
LloadBackend *b = arg;
if ( b == NULL || c->c_private == b ) {
if ( start == upstream_bind ) {
/* FIXME: is upstream_bind safe without a reference of its own? */
CONNECTION_LOCK(c);
} else {
CONNECTION_LOCK_DECREF(c);
}
CONNECTION_DESTROY(c);
CONNECTION_LOCK_DESTROY(c);
return 1;
}
return 0;

View file

@ -361,7 +361,7 @@ upstream_bind( void *ctx, void *arg )
BerElement *ber;
ber_int_t msgid;
CONNECTION_LOCK(c);
CONNECTION_LOCK_DECREF(c);
c->c_pdu_cb = upstream_bind_cb;
CONNECTION_UNLOCK_INCREF(c);
@ -460,6 +460,7 @@ upstream_finish( LloadConnection *c )
b->b_last_conn = c;
} else {
rc = 1;
c->c_refcnt++;
ldap_pvt_thread_pool_submit( &connection_pool, upstream_bind, c );
}