]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h2: add stream lookup function based on the stream ID
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Oct 2017 15:35:14 +0000 (17:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:12:14 +0000 (18:12 +0100)
The function performs a simple lookup in the tree and returns
either the matching h2s or NULL if not found.

src/mux_h2.c

index 629d2758d2805636503902b55672618499f6b1c0..cbc1298d189abd273a615aa534d8e162f0e7f288 100644 (file)
@@ -317,6 +317,18 @@ static int h2_init(struct connection *conn)
        return h2c_frt_init(conn);
 }
 
+/* returns the stream associated with id <id> or NULL if not found */
+static inline struct h2s *h2c_st_by_id(struct h2c *h2c, int id)
+{
+       struct eb32_node *node;
+
+       node = eb32_lookup(&h2c->streams_by_id, id);
+       if (!node)
+               return NULL;
+
+       return container_of(node, struct h2s, by_id);
+}
+
 /* release function for a connection. This one should be called to free all
  * resources allocated to the mux.
  */