diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-05 15:30:57 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-05 16:18:05 +0200 |
commit | 8465f8181eda45e3d6cc5d6c3d08ca36db04763b (patch) | |
tree | 1ca1d03cfe373a1ca28ee021d9b3ec73781fb487 /src/worker.c | |
parent | sanitize #include-s (diff) | |
download | cimple-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 'src/worker.c')
-rw-r--r-- | src/worker.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/worker.c b/src/worker.c index d7cd610..3bfca42 100644 --- a/src/worker.c +++ b/src/worker.c @@ -237,10 +237,13 @@ int worker_main(struct worker *worker) ret = event_loop_run(worker->event_loop); if (ret < 0) goto close; - } -close: - net_close(fd); + close: + net_close(fd); + + if (ret < 0) + break; + } return ret; } |