]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Do not bother to write to a dying connection
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 9 May 2017 15:22:37 +0000 (16:22 +0100)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:55:46 +0000 (17:55 +0000)
servers/lloadd/client.c
servers/lloadd/upstream.c

index 0fcfd6f65c6643912ca2ecae5e870af5078c43d6..51f7c78467220e662fcff13e8217a97f42ee8aa3 100644 (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 );
index 9aa3bd7d644752821aefb73c1ba7ff1fc4d34d97..6a30e82c1eacdba30c6bbea58d967d14617fc941 100644 (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 );