From 4501c3e0992ca03e082cce81e0fff21067a59ddd Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Tue, 28 Aug 2018 19:36:18 +0200 Subject: [PATCH] MINOR: checks: Call wake_srv_chk() when we can finally send data. 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/checks.c b/src/checks.c index 7ad100b55..fc1384580 100644 --- a/src/checks.c +++ b/src/checks.c @@ -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)