diff --git a/servers/lloadd/client.c b/servers/lloadd/client.c index 0fcfd6f65c..51f7c78467 100644 --- a/servers/lloadd/client.c +++ b/servers/lloadd/client.c @@ -200,9 +200,11 @@ client_write_cb( evutil_socket_t s, short what, void *arg ) { Connection *c = arg; - /* What if the shutdown is already in progress and we get to lock the - * connection? */ CONNECTION_LOCK(c); + if ( !c->c_live ) { + CONNECTION_UNLOCK(c); + return; + } CONNECTION_UNLOCK_INCREF(c); ldap_pvt_thread_mutex_lock( &c->c_io_mutex ); diff --git a/servers/lloadd/upstream.c b/servers/lloadd/upstream.c index 9aa3bd7d64..6a30e82c1e 100644 --- a/servers/lloadd/upstream.c +++ b/servers/lloadd/upstream.c @@ -670,6 +670,10 @@ upstream_write_cb( evutil_socket_t s, short what, void *arg ) Connection *c = arg; CONNECTION_LOCK(c); + if ( !c->c_live ) { + CONNECTION_UNLOCK(c); + return; + } CONNECTION_UNLOCK_INCREF(c); ldap_pvt_thread_mutex_lock( &c->c_io_mutex );