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.
This commit is contained in:
Techjar 2022-01-06 02:12:54 -05:00
parent bc14485489
commit 600c8169d5
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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;