1
0
mirror of https://github.com/coturn/coturn.git synced 2026-10-24 00:08:57 +03:00
Files
coturn/examples
Pavel Punsky ca87ff0511 Add --drain-min-allocations: shutdown threshold for drain mode (#1997)
## Summary

In drain mode (entered on SIGUSR1) the server waits for the active
allocation count to reach exactly 0 before shutting down. This PR adds
`--drain-min-allocations=<number>` (also usable as a `turnserver.conf`
key) so drain completes once the active allocation count drops **to the
configured value or below**. The default of 0 preserves the existing
behavior exactly.

This is useful when a small number of long-lived allocations shouldn't
hold up a rolling restart or decommission indefinitely.

## Changes

- `turn_params_t` gains a `drain_min_allocations` field (default 0),
wired through the option enum, long-options table, usage text, and
config parsing. Negative values are logged and clamped to 0.
- The drain check in `run_listener_server` becomes
`global_allocation_count <= turn_params.drain_min_allocations`, and the
"Drain complete" log line now reports the remaining count and threshold.
- Documentation added to the example `turnserver.conf`,
`README.turnserver`, and the `turnserver.1` man page (man page edited in
place to match the committed txt2man output rather than regenerating, to
avoid unrelated formatting churn).

## Validation

- Functional smoke test: with `--drain-min-allocations=10` and 6 live
allocations, SIGUSR1 shut the server down, logging `Drain complete (6
allocations remaining, threshold 10)`. Control run with the default kept
draining while allocations were active. Config-file spelling verified.
- macOS: build, all 15 unit tests, `run_tests.sh`, `run_tests_conf.sh`,
`run_tests_mobile.sh`, `run_tests_multiplex_peer.sh`,
`run_tests_rfc5780.sh` — all pass, no FAIL lines; clang-format clean.
- Fuzzing smoke tests (ASan, both targets): pass.
- Linux (Docker): clean build, ctest, all five system-test suites pass.
- Packaged Debian Docker image (arm64): builds; Bats tests 19/19 pass (2
environment skips).
2026-07-21 22:08:49 -07:00
..
2020-04-28 09:26:31 +00:00
2026-01-05 17:35:27 -08:00
2015-09-15 22:42:39 -07:00
2018-11-05 14:15:36 +00:00
2026-05-17 19:16:55 -07:00
2026-05-17 19:16:55 -07:00