]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: checks: Don't subscribe to I/O events if it is already done
authorChristopher Faulet <cfaulet@haproxy.com>
Sat, 9 May 2020 15:27:43 +0000 (17:27 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 12 May 2020 08:06:47 +0000 (10:06 +0200)
Subscription to I/O events should not be performed if the check is already
subscribed.

No backport needed.

(cherry picked from commit 9e0b3e92f73b6715fb2814e3d09b8ba62270b417)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/checks.c

index 2e6ffc0b7e03d6b1f07fb6f8a7d96e69c3dd8581..3fc5555cac36da83f0decf786b4df7814b841121 100644 (file)
@@ -2635,10 +2635,14 @@ static int tcpcheck_main(struct check *check)
        if (check->current_step && check->current_step->action == TCPCHK_ACT_CONNECT) {
                rule = LIST_NEXT(&check->current_step->list, typeof(rule), list);
                if (conn && (conn->flags & CO_FL_WAIT_XPRT)) {
-                       if (rule->action == TCPCHK_ACT_SEND)
-                               conn->mux->subscribe(cs, SUB_RETRY_SEND, &check->wait_list);
-                       else if (rule->action == TCPCHK_ACT_EXPECT)
-                               conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
+                       if (rule->action == TCPCHK_ACT_SEND) {
+                               if (!(check->wait_list.events & SUB_RETRY_SEND))
+                                       conn->mux->subscribe(cs, SUB_RETRY_SEND, &check->wait_list);
+                       }
+                       else if (rule->action == TCPCHK_ACT_EXPECT) {
+                               if (!(check->wait_list.events & SUB_RETRY_RECV))
+                                       conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
+                       }
                        goto out;
                }
        }
@@ -2736,7 +2740,8 @@ static int tcpcheck_main(struct check *check)
 
                        if (eval_ret == TCPCHK_EVAL_WAIT) {
                                check->current_step = rule->expect.head;
-                               conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
+                               if (!(check->wait_list.events & SUB_RETRY_RECV))
+                                       conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
                        }
                        break;
                case TCPCHK_ACT_ACTION_KW: