Commit 1cb65102 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Quanah Gibson-Mount
Browse files

ITS#8747 Keep an explicit backend pointer

parent 3802fa92
......@@ -390,7 +390,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
checked_unlock( &upstream->c_io_mutex );
if ( !pin ) {
LloadBackend *b = upstream->c_private;
LloadBackend *b = upstream->c_backend;
upstream->c_n_ops_executing--;
CONNECTION_UNLOCK(upstream);
......@@ -440,7 +440,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
/* Was it unlinked in the meantime? No need to send a response since the
* client is dead */
if ( !IS_ALIVE( op, o_refcnt ) ) {
LloadBackend *b = upstream->c_private;
LloadBackend *b = upstream->c_backend;
upstream->c_n_ops_executing--;
checked_unlock( &upstream->c_io_mutex );
......@@ -786,7 +786,7 @@ handle_whoami_response(
LloadBackend *b;
CONNECTION_LOCK(upstream);
b = (LloadBackend *)upstream->c_private;
b = upstream->c_backend;
Debug( LDAP_DEBUG_ANY, "handle_whoami_response: "
"Who Am I? extended operation not supported on backend %s, "
"proxyauthz with clients that do SASL binds will not work "
......@@ -883,7 +883,7 @@ handle_vc_bind_response(
LloadBackend *b;
CONNECTION_LOCK(upstream);
b = (LloadBackend *)upstream->c_private;
b = upstream->c_backend;
Debug( LDAP_DEBUG_ANY, "handle_vc_bind_response: "
"VC extended operation not supported on backend %s\n",
b->b_uri.bv_val );
......
......@@ -111,7 +111,7 @@ request_process( LloadConnection *client, LloadOperation *op )
/* Was it unlinked in the meantime? No need to send a response since the
* client is dead */
if ( !IS_ALIVE( op, o_refcnt ) ) {
LloadBackend *b = upstream->c_private;
LloadBackend *b = upstream->c_backend;
upstream->c_n_ops_executing--;
checked_unlock( &upstream->c_io_mutex );
......@@ -132,7 +132,7 @@ request_process( LloadConnection *client, LloadOperation *op )
output = upstream->c_pendingber;
if ( output == NULL && (output = ber_alloc()) == NULL ) {
LloadBackend *b = upstream->c_private;
LloadBackend *b = upstream->c_backend;
upstream->c_n_ops_executing--;
CONNECTION_UNLOCK(upstream);
......
......@@ -1403,7 +1403,7 @@ backend_conn_cb( ldap_pvt_thread_start_t *start, void *startarg, void *arg )
LloadConnection *c = startarg;
LloadBackend *b = arg;
if ( b == NULL || c->c_private == b ) {
if ( b == NULL || c->c_backend == b ) {
CONNECTION_LOCK_DESTROY(c);
return 1;
}
......
......@@ -402,6 +402,8 @@ struct LloadConnection {
long c_n_ops_completed; /* num of ops completed */
lload_counters_t c_counters; /* per connection operation counters */
LloadBackend *c_backend;
/*
* Protected by the CIRCLEQ mutex:
* - Client: clients_mutex
......
......@@ -328,7 +328,7 @@ operation_unlink_upstream( LloadOperation *op, LloadConnection *upstream )
}
}
operation_update_conn_counters( op, upstream );
b = (LloadBackend *)upstream->c_private;
b = upstream->c_backend;
}
if ( upstream->c_state == LLOAD_C_CLOSING && !upstream->c_ops ) {
CONNECTION_DESTROY(upstream);
......@@ -520,7 +520,7 @@ connection_timeout( LloadConnection *upstream, void *arg )
{
LloadOperation *op;
TAvlnode *ops = NULL, *node, *next;
LloadBackend *b = upstream->c_private;
LloadBackend *b = upstream->c_backend;
time_t threshold = *(time_t *)arg;
int rc, nops = 0;
......
......@@ -273,7 +273,7 @@ fail:
static int
sasl_bind_step( LloadConnection *c, BerValue *scred, BerValue *ccred )
{
LloadBackend *b = c->c_private;
LloadBackend *b = c->c_backend;
sasl_conn_t *ctx = c->c_sasl_authctx;
sasl_interact_t *prompts = NULL;
unsigned credlen;
......@@ -405,7 +405,7 @@ int
upstream_bind_cb( LloadConnection *c )
{
BerElement *ber = c->c_currentber;
LloadBackend *b = c->c_private;
LloadBackend *b = c->c_backend;
BerValue matcheddn, message;
ber_tag_t tag;
ber_int_t msgid, result;
......@@ -611,7 +611,7 @@ fail:
static int
upstream_finish( LloadConnection *c )
{
LloadBackend *b = c->c_private;
LloadBackend *b = c->c_backend;
int is_bindconn = 0;
assert_locked( &b->b_mutex );
......@@ -706,7 +706,7 @@ upstream_tls_handshake_cb( evutil_socket_t s, short what, void *arg )
c->c_connid );
goto fail;
}
b = c->c_private;
b = c->c_backend;
rc = ldap_pvt_tls_connect( lload_tls_backend_ld, c->c_sb, b->b_host );
if ( rc < 0 ) {
......@@ -815,7 +815,7 @@ upstream_starttls( LloadConnection *c )
}
if ( result != LDAP_SUCCESS ) {
LloadBackend *b = c->c_private;
LloadBackend *b = c->c_backend;
int rc;
Debug( LDAP_DEBUG_STATS, "upstream_starttls: "
......@@ -896,7 +896,7 @@ upstream_init( ber_socket_t s, LloadBackend *b )
}
CONNECTION_LOCK(c);
c->c_private = b;
c->c_backend = b;
#ifdef HAVE_TLS
c->c_is_tls = b->b_tls;
#endif
......@@ -993,7 +993,7 @@ fail:
static void
upstream_unlink( LloadConnection *c )
{
LloadBackend *b = c->c_private;
LloadBackend *b = c->c_backend;
struct event *read_event, *write_event;
TAvlnode *root;
long freed, executing;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment