From b485aab7e71c1625cfc27e0f92c9509f42378458 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 13:19:16 +0200 Subject: Adding upstream version 1.45.3+dfsg. Signed-off-by: Daniel Baumann --- src/web/server/h2o/connlist.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/web/server/h2o/connlist.h (limited to 'src/web/server/h2o/connlist.h') diff --git a/src/web/server/h2o/connlist.h b/src/web/server/h2o/connlist.h new file mode 100644 index 000000000..8848b85be --- /dev/null +++ b/src/web/server/h2o/connlist.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef HTTPD_CONNLIST_H +#define HTTPD_CONNLIST_H + +#include "streaming.h" + +// (-1) in following macro is to keep conn list + next pointer +// be power of 2 +#define CONN_LIST_MEMPOOL_SIZE ((2^5)-1) +struct conn_list_leaf { + h2o_stream_conn_t *conn[CONN_LIST_MEMPOOL_SIZE]; + struct conn_list_leaf *next; +}; + +typedef struct { + struct conn_list_leaf *head; + struct conn_list_leaf *tail; + int size; + int capacity; + pthread_mutex_t lock; +} conn_list_t; + +extern conn_list_t conn_list; + +void conn_list_insert(conn_list_t *list, h2o_stream_conn_t *conn); +void conn_list_iter_all(conn_list_t *list, void (*cb)(h2o_stream_conn_t *conn)); +int conn_list_remove_conn(conn_list_t *list, h2o_stream_conn_t *conn); + +#endif /* HTTPD_CONNLIST_H */ -- cgit v1.2.3