mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 14:51:27 +02:00
MINOR: h2: create dummy idle and closed streams
It will be more convenient to always manipulate existing streams than null pointers. Here we create one idle stream and one closed stream. The idea is that we can easily point any stream to one of these states in order to merge maintenance operations.
This commit is contained in:
parent
2373acc384
commit
2a8561895d
25
src/mux_h2.c
25
src/mux_h2.c
@ -21,6 +21,10 @@
|
|||||||
#include <eb32tree.h>
|
#include <eb32tree.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* dummy streams returned for idle and closed states */
|
||||||
|
static const struct h2s *h2_closed_stream;
|
||||||
|
static const struct h2s *h2_idle_stream;
|
||||||
|
|
||||||
/* the h2c connection pool */
|
/* the h2c connection pool */
|
||||||
static struct pool_head *pool2_h2c;
|
static struct pool_head *pool2_h2c;
|
||||||
/* the h2s stream pool */
|
/* the h2s stream pool */
|
||||||
@ -155,6 +159,22 @@ static int h2_settings_header_table_size = 4096; /* initial value */
|
|||||||
static int h2_settings_initial_window_size = 65535; /* initial value */
|
static int h2_settings_initial_window_size = 65535; /* initial value */
|
||||||
static int h2_settings_max_concurrent_streams = 100;
|
static int h2_settings_max_concurrent_streams = 100;
|
||||||
|
|
||||||
|
/* a dmumy closed stream */
|
||||||
|
static const struct h2s *h2_closed_stream = &(const struct h2s){
|
||||||
|
.cs = NULL,
|
||||||
|
.h2c = NULL,
|
||||||
|
.st = H2_SS_CLOSED,
|
||||||
|
.id = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* and a dummy idle stream for use with any unannounced stream */
|
||||||
|
static const struct h2s *h2_idle_stream = &(const struct h2s){
|
||||||
|
.cs = NULL,
|
||||||
|
.h2c = NULL,
|
||||||
|
.st = H2_SS_IDLE,
|
||||||
|
.id = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
/* functions below are for dynamic buffer management */
|
/* functions below are for dynamic buffer management */
|
||||||
@ -322,9 +342,12 @@ static inline struct h2s *h2c_st_by_id(struct h2c *h2c, int id)
|
|||||||
{
|
{
|
||||||
struct eb32_node *node;
|
struct eb32_node *node;
|
||||||
|
|
||||||
|
if (id > h2c->max_id)
|
||||||
|
return (struct h2s *)h2_idle_stream;
|
||||||
|
|
||||||
node = eb32_lookup(&h2c->streams_by_id, id);
|
node = eb32_lookup(&h2c->streams_by_id, id);
|
||||||
if (!node)
|
if (!node)
|
||||||
return NULL;
|
return (struct h2s *)h2_closed_stream;
|
||||||
|
|
||||||
return container_of(node, struct h2s, by_id);
|
return container_of(node, struct h2s, by_id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user