From 0ba6c85a0b87d4c11940e8dacacdee8bf1005fa3 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 18 Jul 2019 15:09:08 +0200 Subject: [PATCH] BUG/MEDIUM: checks: Don't attempt to receive data if we already subscribed. 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/checks.c b/src/checks.c index 920311a02..c2ee60136 100644 --- a/src/checks.c +++ b/src/checks.c @@ -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;