]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: peers: Remove useless statements.
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 24 Jan 2019 17:28:44 +0000 (18:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 29 Jan 2019 09:29:54 +0000 (10:29 +0100)
When implementing peer_recv_msg() we added the statements reached with
a "goto imcomplete" at the end of this function. This statements
are executed only when co_getblk() returns something <0. So they
are useless for now on, and may be safely removed. The following
section wich was responsible of sending any peer protocol messages
were reached only when co_getblk() returned 0 (no more message to
read). In this case we replace the "goto impcomplete" statement by
a "goto send_msgs" to reach this only when peer_recv_msg() returns 0.

May be backported as far as 1.5.

src/peers.c

index 48faa9d8556648fd0ce63d8eaa631c18367d6f29..4a08dd5b62b0419ac1b1ff2a067a7ecfdc4bb901 100644 (file)
@@ -2125,27 +2125,20 @@ switchstate:
                                if (reql <= 0) {
                                        if (reql == -1)
                                                goto switchstate;
-                                       goto incomplete;
+                                       goto send_msgs;
                                }
 
                                msg_end += msg_len;
                                if (!peer_treat_awaited_msg(appctx, curpeer, msg_head, &msg_cur, msg_end, msg_len, totl))
                                        goto switchstate;
-ignore_msg:
+
                                /* skip consumed message */
                                co_skip(si_oc(si), totl);
                                /* loop on that state to peek next message */
                                goto switchstate;
 
-incomplete:
-                               /* we get here when a co_getblk() returns <= 0 in reql */
-
-                               if (reql < 0) {
-                                       /* there was an error */
-                                       appctx->st0 = PEER_SESS_ST_END;
-                                       goto switchstate;
-                               }
-
+send_msgs:
+                               /* we get here when a peer_recv_msg() returns 0 in reql */
                                repl = peer_send_msgs(appctx, curpeer);
                                if (repl <= 0) {
                                        if (repl == -1)