Раньше shutdown_signal вообще не существовал — весь механизм graceful
shutdown в network.rs был мёртвым кодом, ничего его не вызывало. main.rs
теперь spawn'ит net.run() и последовательно ждёт сигнал, затем drain
(НЕ tokio::select! — select! убил бы run()-future на середине drain'а в
момент, когда shutdown-future резолвится). /health на 127.0.0.1 отдаёт
активные соединения — для systemd/LB health-check.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Локальный debug-server и задеплоенный на DEV_IP systemd-сервис раньше
использовали 4443/443 соответственно — развели их на общий 8443, чтобы не
пересекаться с портами, занятыми другими дев-сервисами (например, Caddy на 443).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Сервер получает флаги --require-auth/--backend-url (по умолчанию выключено,
поведение уже развёрнутых нод не меняется). Auth-кадр хендшейка расширен с
"session_id:leg_id" до "session_id:leg_id:token"; при включённом
--require-auth сервер валидирует токен через новый AuthValidator
(BackendClient к netrunner-backend, с кешем на 60с).
Muxer теперь ведёт монотонный учёт трафика сессии (переживает реконнект
ног — раньше total_bytes мог занижаться после переподключения) и раз в ~30с
отчитывается бэкенду; при превышении лимита сессия разрывается. Токен
клиента прокидывается через EngineConfig/TunnelConfig до Tauri-плагина
(desktop.rs + Android Kotlin-плагин).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Downloads were dying and stalling under real network conditions. Root causes
fixed in the muxer's stream-delivery path:
- dispatch_to_local held a DashMap Ref across a nested remove_stream call,
self-deadlocking the leg's reader task whenever a stream's backlog needed
eviction — permanently losing a tokio worker thread per occurrence.
- Eviction now runs off the hot path entirely, in a periodic background
reaper, and only fires when a stream is both over its byte budget AND has
made no delivery progress for an RTT-adaptive grace window (was a flat
300ms then 5s, which killed merely-slow-but-alive consumers).
- The server never told the client when a bridge ended normally (only on
failed connect), leaving the client's virtual TCP socket stuck in
CloseWait for a full idle timeout and slowing the whole engine loop.
- The client's upload path silently dropped in-flight chunks when all tunnel
legs were briefly down instead of pausing and retrying like the server
bridge already did.
- Tried end-to-end credit-based flow control for the download producer;
reverted the enforcement (kept the dormant frame/API) after it proved
worse than the pre-existing local channel backpressure — RTT-coupled
pauses produced burst-then-stall downloads and jitter/ping spikes on the
shared physical leg.
- Server-side diagnostics snapshot was a stub (always-empty tunnel state,
misleading placeholder trigger); now aggregates real per-session Muxer
metrics from the SessionManager.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>