aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/server.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-05 15:30:57 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-05 16:18:05 +0200
commit8465f8181eda45e3d6cc5d6c3d08ca36db04763b (patch)
tree1ca1d03cfe373a1ca28ee021d9b3ec73781fb487 /src/server.c
parentsanitize #include-s (diff)
downloadcimple-8465f8181eda45e3d6cc5d6c3d08ca36db04763b.tar.gz
cimple-8465f8181eda45e3d6cc5d6c3d08ca36db04763b.zip
tcp_server: keep track of client threads
This is a major change, obviously; brought to me by Valgrind, which noticed that we don't actually clean up after cimple-client threads. For a more thorough explanation, please see the added comment in tcp_server.c.
Diffstat (limited to '')
-rw-r--r--src/server.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/server.c b/src/server.c
index b48dc79..2fbb13c 100644
--- a/src/server.c
+++ b/src/server.c
@@ -377,15 +377,11 @@ int server_create(struct server **_server, const struct settings *settings)
if (ret < 0)
goto destroy_storage;
- ret = tcp_server_create(&server->tcp_server, settings->port, cmd_dispatcher_handle_conn,
- server->cmd_dispatcher);
+ ret = tcp_server_create(&server->tcp_server, server->event_loop, settings->port,
+ cmd_dispatcher_handle_conn, server->cmd_dispatcher);
if (ret < 0)
goto destroy_run_queue;
- ret = tcp_server_add_to_event_loop(server->tcp_server, server->event_loop);
- if (ret < 0)
- goto destroy_tcp_server;
-
ret = pthread_create(&server->main_thread, NULL, server_main_thread, server);
if (ret) {
pthread_errno(ret, "pthread_create");