From: Willy Tarreau Date: Fri, 11 Dec 2020 10:19:24 +0000 (+0100) Subject: CLEANUP: connection: open-code conn_cond_update_polling() and update the comment X-Git-Tag: v2.4-dev3~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b250ba738ad4a03e9c53e33536ecef55caccb52;p=thirdparty%2Fhaproxy.git CLEANUP: connection: open-code conn_cond_update_polling() and update the comment 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. --- diff --git a/src/connection.c b/src/connection.c index 13c9930ebc..155e5618e4 100644 --- a/src/connection.c +++ b/src/connection.c @@ -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