diff options
author | dimitri staessens <[email protected]> | 2016-08-04 21:01:28 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-08-04 21:01:28 +0200 |
commit | 7e78d3f2fb1d3203aff64e72589cf98649e4fada (patch) | |
tree | 85e93cd35498887e2c3214c7a52c99de70b584de /src/tools/oping | |
parent | 432e93affce4d5ddcc816f826268bc68d5789756 (diff) | |
download | ouroboros-7e78d3f2fb1d3203aff64e72589cf98649e4fada.tar.gz ouroboros-7e78d3f2fb1d3203aff64e72589cf98649e4fada.zip |
tools: oping: Fix cleanup on exit
The server should cleanup whenever the listen thread exits.
Diffstat (limited to 'src/tools/oping')
-rw-r--r-- | src/tools/oping/oping_server.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c index eb0b511b..a5021cba 100644 --- a/src/tools/oping/oping_server.c +++ b/src/tools/oping/oping_server.c @@ -37,9 +37,7 @@ void shutdown_server(int signo, siginfo_t * info, void * c) case SIGINT: case SIGTERM: case SIGHUP: - pthread_cancel(server.server_pt); pthread_cancel(server.accept_pt); - pthread_cancel(server.cleaner_pt); default: return; } @@ -154,8 +152,12 @@ int server_main() pthread_create(&server.accept_pt, NULL, accept_thread, NULL); pthread_create(&server.server_pt, NULL, server_thread, NULL); - pthread_join(server.server_pt, NULL); pthread_join(server.accept_pt, NULL); + + pthread_cancel(server.server_pt); + pthread_cancel(server.cleaner_pt); + + pthread_join(server.server_pt, NULL); pthread_join(server.cleaner_pt, NULL); return 0; |