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.
diff --git a/src/mux_quic.c b/src/mux_quic.c
index 297d2ad..6230f6d 100644
--- a/src/mux_quic.c
+++ b/src/mux_quic.c
@@ -1655,6 +1655,18 @@
 	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
  * connection <qcc>.
  *
@@ -1670,10 +1682,9 @@
 	}
 
 	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 */
-		TRACE_DEVEL("error on send, subscribing", QMUX_EV_QCC_SEND, qcc->conn);
-		qcc->conn->xprt->subscribe(qcc->conn, qcc->conn->xprt_ctx,
-		                           SUB_RETRY_SEND, &qcc->wait_event);
+		qcc_subscribe_send(qcc);
 		goto err;
 	}
 
@@ -1681,9 +1692,8 @@
 	 * Subscribe on it to retry later.
 	 */
 	if (!LIST_ISEMPTY(frms)) {
-		TRACE_DEVEL("remaining frames to send, subscribing", QMUX_EV_QCC_SEND, qcc->conn);
-		qcc->conn->xprt->subscribe(qcc->conn, qcc->conn->xprt_ctx,
-		                           SUB_RETRY_SEND, &qcc->wait_event);
+		TRACE_DEVEL("remaining frames to send", QMUX_EV_QCC_SEND, qcc->conn);
+		qcc_subscribe_send(qcc);
 		goto err;
 	}