summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2021-01-08 20:20:54 +0100
committerGitHub <noreply@github.com>2021-01-08 20:20:54 +0100
commit31d19680043cecaaca31dba3fee341699db1b7a3 (patch)
tree9eda886fa391ff22e4ee1c101a6f7aad95ddd92c
parent7ba0fa4bf01ff7e9f08a10a83c27243733f0a18c (diff)
downloadopenttd-31d19680043cecaaca31dba3fee341699db1b7a3.tar.xz
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.
-rw-r--r--src/network/network_content.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index 1c19a2b52..9ed6551c6 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -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));