From 600c8169d5c924dfccabca05d643e265d5f09ebe Mon Sep 17 00:00:00 2001 From: Techjar Date: Thu, 6 Jan 2022 02:12:54 -0500 Subject: [PATCH] Core/NetPlay: Extend enet peer timeout This extends the timeout to 30 seconds, so users who have brief connection issues won't be so swiftly disconnected, allowing the NetPlay session to continue. --- Source/Core/Core/NetPlayClient.cpp | 3 +++ Source/Core/Core/NetPlayServer.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index ff9dca8c22..6dad22e5ba 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -150,6 +150,9 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay return; } + // Extend reliable traffic timeout + enet_peer_timeout(m_server, 0, 30000, 30000); + ENetEvent netEvent; int net = enet_host_service(m_client, &netEvent, 5000); if (net > 0 && netEvent.type == ENET_EVENT_TYPE_CONNECT) diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index ee1ed43cde..ed1527c0c5 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -415,6 +415,9 @@ ConnectionError NetPlayServer::OnConnect(ENetPeer* socket, sf::Packet& rpac) if (StringUTF8CodePointCount(player.name) > MAX_NAME_LENGTH) return ConnectionError::NameTooLong; + // Extend reliable traffic timeout + enet_peer_timeout(socket, 0, 30000, 30000); + // cause pings to be updated m_update_pings = true;