]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h2: small function to know when the mux is busy
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Sep 2017 14:17:25 +0000 (16:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:12:14 +0000 (18:12 +0100)
A mux is busy when any stream id >= 0 is currently being handled
and the current stream's id doesn't match. When no stream is
involved (ie: demuxer), stream 0 is considered. This will be
necessary to know when it's possible to send frames.

src/mux_h2.c

index ea4f90f7a85e526f9cdd4d10a1a837aa5b38d5c6..370494d5bc7b0046d2303e9adbede7ec80a6e3c1 100644 (file)
@@ -361,6 +361,18 @@ static inline int h2s_id(const struct h2s *h2s)
        return h2s ? h2s->id : 0;
 }
 
+/* returns true of the mux is currently busy as seen from stream <h2s> */
+static inline int h2c_mux_busy(const struct h2c *h2c, const struct h2s *h2s)
+{
+       if (h2c->msi < 0)
+               return 0;
+
+       if (h2c->msi == h2s_id(h2s))
+               return 0;
+
+       return 1;
+}
+
 
 /*********************************************************/
 /* functions below are I/O callbacks from the connection */