]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Drain obuf if the output is closed after sending data
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Dec 2018 09:56:20 +0000 (10:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Dec 2018 13:11:29 +0000 (14:11 +0100)
It avoids to subscribe to send events because some may remain in the output
buffer. If the output is closed or if an error occurred, there is no way to send
these data anyway, so it is safe to drain them.

src/mux_h1.c

index c55fb7cd13cad6b8e8dd4279eaf2dc39dc317869..3b845a6ec93e409d9807786754f4e4b04fbefa78 100644 (file)
@@ -1627,6 +1627,11 @@ static int h1_send(struct h1c *h1c)
                sent = 1;
        }
 
+       if (conn->flags & (CO_FL_ERROR|CO_FL_SOCK_WR_SH)) {
+               /* error or output closed, nothing to send, clear the buffer to release it */
+               b_reset(&h1c->obuf);
+       }
+
   end:
        if (!(h1c->flags & H1C_F_OUT_FULL) && h1c->h1s && h1c->h1s->send_wait) {
                struct h1s *h1s = h1c->h1s;