From: Olivier Houchard Date: Fri, 18 Oct 2019 12:18:29 +0000 (+0200) Subject: BUG/MEDIUM: mux_pt: Only call the wake emthod if nobody subscribed to receive. X-Git-Tag: v2.1-dev3~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ed389dc6e27257997f83e3f22cb6bf8898a2a5a;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: mux_pt: Only call the wake emthod if nobody subscribed to receive. In mux_pt_io_cb(), instead of always calling the wake method, only do so if nobody subscribed for receive. If we have a subscription, just wake the associated tasklet up. This should be backported to 1.9 and 2.0. --- diff --git a/src/mux_pt.c b/src/mux_pt.c index da35a8e239..6092a92b68 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -55,13 +55,15 @@ static struct task *mux_pt_io_cb(struct task *t, void *tctx, unsigned short stat * mux_pt_io_cb() is only supposed to be called if we have no * stream attached. However, maybe the tasklet got woken up, * and this connection was then attached to a new stream. - * If this happened, just call the wake method. It is probably - * not needed, because the stream probably subscribed to - * receive events, but that way we'll be sure the event got - * noticed, and if we had any error on the connection, we will - * let the stream call the detach method to destroy it. + * If this happened, just wake the tasklet up if anybody + * subscribed to receive events, and otherwise call the wake + * method, to make sure the event is noticed. */ - if (ctx->cs->data_cb->wake) + if (ctx->conn->recv_wait) { + ctx->conn->recv_wait->events &= ~SUB_RETRY_RECV; + tasklet_wakeup(ctx->conn->recv_wait->tasklet); + ctx->conn->recv_wait = NULL; + } else if (ctx->cs->data_cb->wake) ctx->cs->data_cb->wake(ctx->cs); return NULL; }