From 08ee3cab641f367b642bc29f6540de6be85226bd Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 25 Aug 2022 10:47:06 +0200 Subject: net: rework API First, rename all API functions so that they start with net_. Second, abstract the basic TCP server functionality into tcp_server.c. This includes reworking net_accept so that it's a simple blocking operation, and putting the callback stuff to tcp_server.c. Also, the server now uses detached threads instead of fork(), since I want connection handlers to share memory. --- src/server.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/server.h') diff --git a/src/server.h b/src/server.h index 8a46314..11c409b 100644 --- a/src/server.h +++ b/src/server.h @@ -1,12 +1,14 @@ #ifndef __SERVER_H__ #define __SERVER_H__ +#include "tcp_server.h" + struct settings { const char *port; }; struct server { - int fd; + struct tcp_server tcp_server; }; int server_create(struct server *, const struct settings *); -- cgit v1.3