1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 04:29:09 +00:00

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.
This commit is contained in:
frosch
2021-01-08 20:20:54 +01:00
committed by GitHub
parent 7ba0fa4bf0
commit 31d1968004

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