Do not bother to write to a dying connection

This commit is contained in:
Ondřej Kuzník 2017-05-09 16:22:37 +01:00 committed by Ondřej Kuzník
parent 77f2c57132
commit 6899d0123d
2 changed files with 8 additions and 2 deletions

View file

@ -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 );

View file

@ -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 );