diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-28 23:31:07 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-28 23:31:07 +0100 |
| commit | 772873104658182a5b76f5c0eed76047c62c6651 (patch) | |
| tree | 431ba9c063fab10b4356cd8c7e63c9d2e957e2d9 /opentracker.c | |
| parent | dd0ad26ea9824b75accced2b56328cbb222c4c6d (diff) | |
With more workers blockingly waiting on udp sockets, we need to keep track of all sockets to shut them down on exit
Diffstat (limited to 'opentracker.c')
| -rw-r--r-- | opentracker.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/opentracker.c b/opentracker.c index f579b92..ab4a934 100644 --- a/opentracker.c +++ b/opentracker.c | |||
| @@ -397,7 +397,6 @@ static void listen_start_udp_workers(void) { | |||
| 397 | if (entry->proto != FLAG_UDP || entry->workers <= 0) | 397 | if (entry->proto != FLAG_UDP || entry->workers <= 0) |
| 398 | continue; | 398 | continue; |
| 399 | 399 | ||
| 400 | socket_set_blocking((int)entry->sock, 1); | ||
| 401 | event_del((int)entry->sock); | 400 | event_del((int)entry->sock); |
| 402 | udp_worker_install(entry->sock); | 401 | udp_worker_install(entry->sock); |
| 403 | 402 | ||
| @@ -409,8 +408,7 @@ static void listen_start_udp_workers(void) { | |||
| 409 | if (sock == -1) { | 408 | if (sock == -1) { |
| 410 | fprintf(stderr, "Warning: could not bind another socket for udp worker %d: %s. Sharing the first instead.\n", worker, strerror(errno)); | 409 | fprintf(stderr, "Warning: could not bind another socket for udp worker %d: %s. Sharing the first instead.\n", worker, strerror(errno)); |
| 411 | sock = entry->sock; | 410 | sock = entry->sock; |
| 412 | } else | 411 | } |
| 413 | socket_set_blocking((int)sock, 1); | ||
| 414 | } | 412 | } |
| 415 | udp_worker_install(sock); | 413 | udp_worker_install(sock); |
| 416 | } | 414 | } |
| @@ -548,9 +546,10 @@ int main(int argc, char **argv) { | |||
| 548 | listen_start_udp_workers(); | 546 | listen_start_udp_workers(); |
| 549 | 547 | ||
| 550 | server_mainloop(0); | 548 | server_mainloop(0); |
| 549 | udp_workers_deinit(); | ||
| 551 | 550 | ||
| 552 | /* The loop has left, so no thread is serving any more and the teardown | 551 | /* No thread is serving any more, so the teardown can run where a debugger |
| 553 | can run where a debugger and the sanitizers can follow it */ | 552 | and the sanitizers can follow it */ |
| 554 | trackerlogic_deinit(); | 553 | trackerlogic_deinit(); |
| 555 | #ifdef WANT_SYSLOGS | 554 | #ifdef WANT_SYSLOGS |
| 556 | closelog(); | 555 | closelog(); |
