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.
This commit is contained in:
Frdric Lcaille 2019-01-24 18:28:44 +01:00 committed by Willy Tarreau
parent 25e1d5e435
commit be825e5c05

View 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)