aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-10-06 21:03:59 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-10-06 21:03:59 +0200
commitdb9cb051c4ee05c07ab32dfed5bae8b7dc0916bd (patch)
tree44e1efae86af612923ec5486c00eb2c56019c865 /include
parent4918cf87d3cf5d3dd8425fe10d97a06282472df6 (diff)
Allow custom backlog connections
libweb calls listen(2) when setting up the HTTP server, and its backlog argument was hardcoded to 10. While probably not an issue for some applications, it can be too limiting for some others. Therefore, it is desirable to allow library users to set up their own limits. Otherwise, 10 is still chosen as a sane default.
Diffstat (limited to 'include')
-rw-r--r--include/libweb/handler.h1
-rw-r--r--include/libweb/server.h3
2 files changed, 3 insertions, 1 deletions
diff --git a/include/libweb/handler.h b/include/libweb/handler.h
index 7e0b601..97fdca0 100644
--- a/include/libweb/handler.h
+++ b/include/libweb/handler.h
@@ -15,6 +15,7 @@ struct handler_cfg
void *user;
size_t max_headers;
struct http_cfg_post post;
+ unsigned backlog;
};
struct handler *handler_alloc(const struct handler_cfg *cfg);
diff --git a/include/libweb/server.h b/include/libweb/server.h
index 08e0f34..42af6e6 100644
--- a/include/libweb/server.h
+++ b/include/libweb/server.h
@@ -4,7 +4,8 @@
#include <stdbool.h>
#include <stddef.h>
-struct server *server_init(unsigned short port, unsigned short *outport);
+struct server *server_init(unsigned short port, unsigned short *outport,
+ unsigned backlog);
struct server_client *server_poll(struct server *s, bool *io, bool *exit);
int server_read(void *buf, size_t n, struct server_client *c);
int server_write(const void *buf, size_t n, struct server_client *c);