From: Amaury Denoyelle Date: Wed, 6 Jul 2022 12:54:34 +0000 (+0200) Subject: MINOR: mux-quic: implement qcs_alert() X-Git-Tag: v2.7-dev2~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4561f84ad407064491c8c99e0bef87f03450b739;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: implement qcs_alert() Implement a simple function to notify a possible subscriber or wake up the upper layer if a special condition happens on a stream. For the moment, this is only used to replace identical code in qc_wake_some_streams(). --- diff --git a/src/mux_quic.c b/src/mux_quic.c index cb3e362ff0..0263c07a63 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -248,6 +248,20 @@ static struct ncbuf *qc_get_ncbuf(struct qcs *qcs, struct ncbuf *ncbuf) return ncbuf; } +/* Notify an eventual subscriber on or else wakup up the stconn layer if + * initialized. + */ +static void qcs_alert(struct qcs *qcs) +{ + if (qcs->subs) { + qcs_notify_recv(qcs); + qcs_notify_send(qcs); + } + else if (qcs_sc(qcs) && qcs->sd->sc->app_ops->wake) { + qcs->sd->sc->app_ops->wake(qcs->sd->sc); + } +} + int qcs_subscribe(struct qcs *qcs, int event_type, struct wait_event *es) { struct qcc *qcc = qcs->qcc; @@ -1746,13 +1760,7 @@ static int qc_wake_some_streams(struct qcc *qcc) if (se_fl_test(qcs->sd, SE_FL_EOS)) se_fl_set(qcs->sd, SE_FL_ERROR); - if (qcs->subs) { - qcs_notify_recv(qcs); - qcs_notify_send(qcs); - } - else if (qcs->sd->sc->app_ops->wake) { - qcs->sd->sc->app_ops->wake(qcs->sd->sc); - } + qcs_alert(qcs); } }