]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: Don't attempt to receive data if we already subscribed.
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 18 Jul 2019 13:09:08 +0000 (15:09 +0200)
committerOlivier Houchard <cognet@ci0.org>
Thu, 18 Jul 2019 14:42:45 +0000 (16:42 +0200)
tcpcheck_main() might be called while we already attempted to subscribe, and
failed. There's no point in trying to call rcv_buf() again, and failing
would lead to us trying to subscribe again, which is not allowed.

This should be backported to 2.0 and 1.9.

src/checks.c

index 920311a029f86e6bd197da76082c911274219961..c2ee60136b581e827d006ca43f5ec40ae2c246ce 100644 (file)
@@ -3010,6 +3010,11 @@ static int tcpcheck_main(struct check *check)
                        if (unlikely(check->result == CHK_RES_FAILED))
                                goto out_end_tcpcheck;
 
+                       /* If we already subscribed, then we tried to received
+                        * and failed, so there's no point trying again.
+                        */
+                       if (check->wait_list.events & SUB_RETRY_RECV)
+                               break;
                        if (cs->conn->mux->rcv_buf(cs, &check->bi, b_size(&check->bi), 0) <= 0) {
                                if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH) || cs->flags & CS_FL_ERROR) {
                                        done = 1;