]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: connection: open-code conn_cond_update_polling() and update the comment
authorWilly Tarreau <w@1wt.eu>
Fri, 11 Dec 2020 10:19:24 +0000 (11:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 Dec 2020 10:19:24 +0000 (11:19 +0100)
This last call to conn_cond_update_polling() is now totally misleading as
the function only stops polling in case of unrecoverable connection error.
Let's open-code the test to make it more prominent and explain what we're
trying to do there. It's even almost certain this code is never executed
anymore, as the only remaining case should be a mux's wake function setting
CO_FL_ERROR without disabling the polling, but they need to be audited first
to make sure this is the case.

src/connection.c

index 13c9930ebc75872806e514af65b962d8f3131f6e..155e5618e426bb5519bd647b49aa8448e4b4de3c 100644 (file)
@@ -177,9 +177,16 @@ void conn_fd_handler(int fd)
            conn->mux && conn->mux->wake && conn->mux->wake(conn) < 0)
                return;
 
-       /* commit polling changes */
-       conn_cond_update_polling(conn);
-       return;
+       /* commit polling changes in case of error.
+        * WT: it seems that the last case where this could still be relevant
+        * is if a mux wake function above report a connection error but does
+        * not stop polling. Shouldn't we enforce this into the mux instead of
+        * having to deal with this ?
+        */
+       if (unlikely(conn->flags & CO_FL_ERROR)) {
+               if (conn_ctrl_ready(conn))
+                       fd_stop_both(fd);
+       }
 }
 
 /* This is the callback which is set when a connection establishment is pending