MEDIUM: check: Use the CS to handle subscriptions for read/write events
Instead of using the health-check to subscribe to read/write events, we now
rely on the conn-stream. Indeed, on the server side, the conn-stream's
endpoint is a multiplexer. Thus it seems appropriate to handle subscriptions
for read/write events the same way than for the streams. Of course, the I/O
callback function is not the same. We use srv_chk_io_cb() instead of
cs_conn_io_cb().
diff --git a/src/tcpcheck.c b/src/tcpcheck.c
index 4a4e071..3b1d75a 100644
--- a/src/tcpcheck.c
+++ b/src/tcpcheck.c
@@ -1071,8 +1071,8 @@
if (conn->flags & CO_FL_WAIT_XPRT) {
/* We are still waiting for the connection establishment */
if (next && next->action == TCPCHK_ACT_SEND) {
- if (!(check->wait_list.events & SUB_RETRY_SEND))
- conn->mux->subscribe(check->cs, SUB_RETRY_SEND, &check->wait_list);
+ if (!(check->cs->wait_event.events & SUB_RETRY_SEND))
+ conn->mux->subscribe(check->cs, SUB_RETRY_SEND, &check->cs->wait_event);
ret = TCPCHK_EVAL_WAIT;
TRACE_DEVEL("not connected yet", CHK_EV_TCPCHK_CONN, check);
}
@@ -1108,12 +1108,8 @@
goto fail_check;
}
conn->ctx = check->cs;
- tasklet_set_tid(check->wait_list.tasklet, tid);
conn_set_owner(conn, check->sess, NULL);
- /* Maybe there were an older connection we were waiting on */
- check->wait_list.events = 0;
-
/* no client address */
if (!sockaddr_alloc(&conn->dst, NULL, 0)) {
TRACE_ERROR("sockaddr allocation error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
@@ -1298,9 +1294,9 @@
if (conn->flags & CO_FL_WAIT_XPRT) {
if (conn->mux) {
if (next && next->action == TCPCHK_ACT_SEND)
- conn->mux->subscribe(check->cs, SUB_RETRY_SEND, &check->wait_list);
+ conn->mux->subscribe(check->cs, SUB_RETRY_SEND, &check->cs->wait_event);
else
- conn->mux->subscribe(check->cs, SUB_RETRY_RECV, &check->wait_list);
+ conn->mux->subscribe(check->cs, SUB_RETRY_RECV, &check->cs->wait_event);
}
ret = TCPCHK_EVAL_WAIT;
TRACE_DEVEL("not connected yet", CHK_EV_TCPCHK_CONN, check);
@@ -1495,7 +1491,7 @@
}
}
if ((IS_HTX_CONN(conn) && !htx_is_empty(htxbuf(&check->bo))) || (!IS_HTX_CONN(conn) && b_data(&check->bo))) {
- conn->mux->subscribe(cs, SUB_RETRY_SEND, &check->wait_list);
+ conn->mux->subscribe(cs, SUB_RETRY_SEND, &cs->wait_event);
ret = TCPCHK_EVAL_WAIT;
TRACE_DEVEL("data not fully sent, wait", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA, check);
goto out;
@@ -1547,7 +1543,7 @@
TRACE_ENTER(CHK_EV_RX_DATA, check);
- if (check->wait_list.events & SUB_RETRY_RECV) {
+ if (cs->wait_event.events & SUB_RETRY_RECV) {
TRACE_DEVEL("waiting for response", CHK_EV_RX_DATA, check);
goto wait_more_data;
}
@@ -1600,7 +1596,7 @@
goto out;
}
if (!(cs->endp->flags & (CS_EP_WANT_ROOM|CS_EP_ERROR|CS_EP_EOS))) {
- conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
+ conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event);
TRACE_DEVEL("waiting for response", CHK_EV_RX_DATA, check);
goto wait_more_data;
}
@@ -2237,8 +2233,8 @@
if (eval_ret == TCPCHK_EVAL_WAIT) {
check->current_step = rule->expect.head;
- if (!(check->wait_list.events & SUB_RETRY_RECV))
- conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
+ if (!(cs->wait_event.events & SUB_RETRY_RECV))
+ conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event);
}
break;
case TCPCHK_ACT_ACTION_KW: