]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: checks: Simplify connection flag parsing in tcp-check connect
authorGaetan Rivet <grive@u256.net>
Fri, 28 Feb 2020 10:04:21 +0000 (11:04 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Apr 2020 07:39:37 +0000 (09:39 +0200)
The ternary operator is useless here, this can be simpler and clearer to
read.

src/checks.c

index a685d07c9dd19b2b51f2340091c2f21f042cba80..4470c8f4a3921cff6b49c4276761e66968c6208d 100644 (file)
@@ -2977,9 +2977,14 @@ static int tcpcheck_main(struct check *check)
                        cs_attach(cs, check, &check_conn_cb);
 
                        ret = SF_ERR_INTERNAL;
-                       if (proto && proto->connect)
-                               ret = proto->connect(conn,
-                                                    CONNECT_HAS_DATA /* I/O polling is always needed */ | ((next && next->action == TCPCHK_ACT_EXPECT) ? 0 : CONNECT_DELACK_ALWAYS));
+                       if (proto && proto->connect) {
+                               int flags;
+
+                               flags = CONNECT_HAS_DATA;
+                               if (next && next->action != TCPCHK_ACT_EXPECT)
+                                       flags |= CONNECT_DELACK_ALWAYS;
+                               ret = proto->connect(conn, flags);
+                       }
                        if (conn_ctrl_ready(conn) &&
                                check->current_step->conn_opts & TCPCHK_OPT_SEND_PROXY) {
                                conn->send_proxy_ofs = 1;