1
0
Fork 0

Fix: Start the inactivity-timeout for the content server only after the connection has been established. (#8530)

When connecting took long due to the first N resolve-addresses timing out, OpenTTD would immediately close the connection, without sending anything.
pull/8032/head
frosch 2021-01-08 20:20:54 +01:00 committed by GitHub
parent 7ba0fa4bf0
commit 31d1968004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -743,6 +743,7 @@ public:
void OnConnect(SOCKET s) override
{
assert(_network_content_client.sock == INVALID_SOCKET);
_network_content_client.lastActivity = _realtime_tick;
_network_content_client.isConnecting = false;
_network_content_client.sock = s;
_network_content_client.Reopen();
@ -755,8 +756,6 @@ public:
*/
void ClientNetworkContentSocketHandler::Connect()
{
this->lastActivity = _realtime_tick;
if (this->sock != INVALID_SOCKET || this->isConnecting) return;
this->isConnecting = true;
new NetworkContentConnecter(NetworkAddress(NETWORK_CONTENT_SERVER_HOST, NETWORK_CONTENT_SERVER_PORT, AF_UNSPEC));