mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-11 05:48:41 +00:00
MINOR: mux-quic: factorize send subscribing
Factorize code for send subscribing on the lower layer in a dedicated function qcc_subscribe_send(). This allows to call the lower layer only if not already subscribed and print a trace in this case. This should help to understand when subscribing is really performed. In the future, this function may be extended to avoid subscribing under new conditions, such as connection already on error. This should be backported up to 2.7.
This commit is contained in:
parent
04b2208aa0
commit
b35e32e43b
@ -1655,6 +1655,18 @@ void qcc_streams_sent_done(struct qcs *qcs, uint64_t data, uint64_t offset)
|
|||||||
TRACE_LEAVE(QMUX_EV_QCS_SEND, qcc->conn, qcs);
|
TRACE_LEAVE(QMUX_EV_QCS_SEND, qcc->conn, qcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns true if subscribe set, false otherwise. */
|
||||||
|
static int qcc_subscribe_send(struct qcc *qcc)
|
||||||
|
{
|
||||||
|
struct connection *conn = qcc->conn;
|
||||||
|
if (qcc->wait_event.events & SUB_RETRY_SEND)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
TRACE_DEVEL("subscribe for send", QMUX_EV_QCC_SEND, qcc->conn);
|
||||||
|
conn->xprt->subscribe(conn, conn->xprt_ctx, SUB_RETRY_SEND, &qcc->wait_event);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Wrapper for send on transport layer. Send a list of frames <frms> for the
|
/* Wrapper for send on transport layer. Send a list of frames <frms> for the
|
||||||
* connection <qcc>.
|
* connection <qcc>.
|
||||||
*
|
*
|
||||||
@ -1670,10 +1682,9 @@ static int qc_send_frames(struct qcc *qcc, struct list *frms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!qc_send_mux(qcc->conn->handle.qc, frms)) {
|
if (!qc_send_mux(qcc->conn->handle.qc, frms)) {
|
||||||
|
TRACE_DEVEL("error on sending", QMUX_EV_QCC_SEND, qcc->conn);
|
||||||
/* TODO should subscribe only for a transient send error */
|
/* TODO should subscribe only for a transient send error */
|
||||||
TRACE_DEVEL("error on send, subscribing", QMUX_EV_QCC_SEND, qcc->conn);
|
qcc_subscribe_send(qcc);
|
||||||
qcc->conn->xprt->subscribe(qcc->conn, qcc->conn->xprt_ctx,
|
|
||||||
SUB_RETRY_SEND, &qcc->wait_event);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1681,9 +1692,8 @@ static int qc_send_frames(struct qcc *qcc, struct list *frms)
|
|||||||
* Subscribe on it to retry later.
|
* Subscribe on it to retry later.
|
||||||
*/
|
*/
|
||||||
if (!LIST_ISEMPTY(frms)) {
|
if (!LIST_ISEMPTY(frms)) {
|
||||||
TRACE_DEVEL("remaining frames to send, subscribing", QMUX_EV_QCC_SEND, qcc->conn);
|
TRACE_DEVEL("remaining frames to send", QMUX_EV_QCC_SEND, qcc->conn);
|
||||||
qcc->conn->xprt->subscribe(qcc->conn, qcc->conn->xprt_ctx,
|
qcc_subscribe_send(qcc);
|
||||||
SUB_RETRY_SEND, &qcc->wait_event);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user