]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: checks: Call wake_srv_chk() when we can finally send data.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 28 Aug 2018 17:36:18 +0000 (19:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 Aug 2018 17:43:57 +0000 (19:43 +0200)
Instead of calling __event_srv_chk_w, call wake_srv_chk(), which will then
either call tcpcheck_main() or __event_srv_chk_w().
Also make tcpcheck_main() subscribe if it can't send.

src/checks.c

index 7ad100b5501105e691ef00ff3d5a721bdd67f85a..fc1384580f71a0b8c05415c419f045ae95b85b55 100644 (file)
@@ -70,6 +70,7 @@ static int tcpcheck_get_step_id(struct check *);
 static char * tcpcheck_get_step_comment(struct check *, int);
 static int tcpcheck_main(struct check *);
 static void __event_srv_chk_w(struct conn_stream *cs);
+static int wake_srv_chk(struct conn_stream *cs);
 
 static struct pool_head *pool_head_email_alert   = NULL;
 static struct pool_head *pool_head_tcpcheck_rule = NULL;
@@ -709,12 +710,9 @@ static void chk_report_conn_err(struct check *check, int errno_bck, int expired)
 static struct task *event_srv_chk_io(struct task *t, void *ctx, unsigned short state)
 {
        struct conn_stream *cs = ctx;
-       struct check *check = cs->data;
-       if (!(cs->wait_list.wait_reason & SUB_CAN_SEND)) {
-               HA_SPIN_LOCK(SERVER_LOCK, &check->server->lock);
-               __event_srv_chk_w(cs);
-               HA_SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
-       }
+
+       if (!(cs->wait_list.wait_reason & SUB_CAN_SEND))
+               wake_srv_chk(cs);
        return NULL;
 }
 
@@ -2704,6 +2702,10 @@ static int tcpcheck_main(struct check *check)
                                }
                                break;
                        }
+                       if (b_data(&check->bo)) {
+                               cs->conn->mux->subscribe(cs, SUB_CAN_SEND, &cs->wait_list);
+                               goto out;
+                       }
                }
 
                if (&check->current_step->list == head)