summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/connlist.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:22 +0000
commitc21c3b0befeb46a51b6bf3758ffa30813bea0ff0 (patch)
tree9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/connlist.h
parentAdding upstream version 1.43.2. (diff)
downloadnetdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.tar.xz
netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.zip
Adding upstream version 1.44.3.upstream/1.44.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--web/server/h2o/connlist.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/web/server/h2o/connlist.h b/web/server/h2o/connlist.h
new file mode 100644
index 000000000..8848b85be
--- /dev/null
+++ b/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 */