Merge pull request #10350 from Techjar/netplay-longer-timeout

Core/NetPlay: Extend enet peer timeout
This commit is contained in:
Mai M 2022-01-06 03:58:58 -05:00 committed by GitHub
commit c0fada6fec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;