]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream-interface: the polling flags must always be updated in chk_snd_conn
authorWilly Tarreau <w@1wt.eu>
Tue, 21 Jan 2014 09:27:49 +0000 (10:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 25 Jan 2014 23:42:30 +0000 (00:42 +0100)
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.

src/stream_interface.c

index abbbcb10ac698c3473fea82a8b29f86352010d2c..bb5b962b60875d8729581543cde9b628d3d5b7d2 100644 (file)
@@ -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 */