From: Frédéric Lécaille Date: Thu, 24 Jan 2019 17:28:44 +0000 (+0100) Subject: CLEANUP: peers: Remove useless statements. X-Git-Tag: v2.0-dev1~130 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be825e5c05c3be646f7ed1ff9325017742e9330e;p=thirdparty%2Fhaproxy.git CLEANUP: peers: Remove useless statements. 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. --- diff --git a/src/peers.c b/src/peers.c index 48faa9d855..4a08dd5b62 100644 --- a/src/peers.c +++ b/src/peers.c @@ -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)