]> git.ipfire.org Git - thirdparty/haproxy.git/commit
OPTIM: stream_interface: return directly if the connection flag CO_FL_ERROR has been set
authorGodbach <nylzhaowei@gmail.com>
Wed, 4 Dec 2013 09:24:06 +0000 (17:24 +0800)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Dec 2013 09:46:09 +0000 (10:46 +0100)
commit4f48990c1a8ae7944ef1b43081ece6cc4de7d22e
tree551693a4a754a3835b216abcb3200b3af3dc811f
parent64cef79348ff080e752f1d74e6785692535c791b
OPTIM: stream_interface: return directly if the connection flag CO_FL_ERROR has been set

The connection flag CO_FL_ERROR will be tested in the functions both
si_conn_recv_cb() and si_conn_send_cb(). If CO_FL_ERROR has been set, out_error
branch will be executed. But the only job of out_error branch is to set
CO_FL_ERROR on connection flag. So it's better return directly than goto
out_error branch under such conditions. As a result, out_error branch becomes
needless and can be removed.

In addition, the return type of si_conn_send_loop() is also changed to void.
The caller should check conn->flags for errors just like stream_int_chk_snd_conn()
does as below:

static void stream_int_chk_snd_conn(struct stream_interface *si)
{
...
        conn_refresh_polling_flags(si->conn);

-       if (si_conn_send(si->conn) < 0) {
+       si_conn_send(si->conn);
+       if (si->conn->flags & CO_FL_ERROR) {
...
}

Signed-off-by: Godbach <nylzhaowei@gmail.com>
src/stream_interface.c