From: Willy Tarreau Date: Tue, 21 Jan 2014 09:27:49 +0000 (+0100) Subject: MEDIUM: stream-interface: the polling flags must always be updated in chk_snd_conn X-Git-Tag: v1.5-dev22~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=708e71725160b2ab10c84045f0e56a3c8ba99518;p=thirdparty%2Fhaproxy.git MEDIUM: stream-interface: the polling flags must always be updated in chk_snd_conn We used to only update the polling flags in data phase, but after that we could update other flags. It does not seem possible to trigger a bug here but it's not very safe either. Better always keep them up to date. --- diff --git a/src/stream_interface.c b/src/stream_interface.c index abbbcb10ac..bb5b962b60 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -980,15 +980,13 @@ static void stream_int_chk_snd_conn(struct stream_interface *si) return; } - if (!(conn->flags & (CO_FL_HANDSHAKE|CO_FL_WAIT_L4_CONN|CO_FL_WAIT_L6_CONN))) { - /* Before calling the data-level operations, we have to prepare - * the polling flags to ensure we properly detect changes. - */ - if (conn_ctrl_ready(conn)) - fd_want_send(conn->t.sock.fd); - - conn_refresh_polling_flags(conn); + /* Before calling the data-level operations, we have to prepare + * the polling flags to ensure we properly detect changes. + */ + conn_refresh_polling_flags(conn); + __conn_data_want_send(conn); + if (!(conn->flags & (CO_FL_HANDSHAKE|CO_FL_WAIT_L4_CONN|CO_FL_WAIT_L6_CONN))) { si_conn_send(conn); if (conn_ctrl_ready(conn) && (conn->flags & CO_FL_ERROR)) { /* Write error on the file descriptor */