From c02a93dd5e86e3134aedf330bca748e9d1a91cb6 Mon Sep 17 00:00:00 2001 From: bectly Date: Thu, 19 Nov 2026 13:28:39 +0100 Subject: [PATCH] fix(stream): apply ping_timeout to the ENet control peer The control stream peer never received enet_peer_timeout(), so it kept ENet's defaults (5 s minimum). On links with short outages the host disconnected the client after ~5 s regardless of ping_timeout. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011uyno7VQowGYGzwwcHAfBT --- src/stream.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stream.cpp b/src/stream.cpp index a222b4045e2..8b0b31b4a4d 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -784,6 +784,9 @@ namespace stream { break; case ENET_EVENT_TYPE_CONNECT: BOOST_LOG(info) << "CLIENT CONNECTED"sv; + // Without this the peer keeps ENet's default timeout (5 s minimum), so a short network outage + // drops the client even though the session itself tolerates ping_timeout. + enet_peer_timeout(event.peer, 0, (enet_uint32) config::stream.ping_timeout.count(), (enet_uint32) config::stream.ping_timeout.count()); break; case ENET_EVENT_TYPE_DISCONNECT: BOOST_LOG(info) << "CLIENT DISCONNECTED"sv;