mirror of https://github.com/OpenTTD/OpenTTD
Fix: [Network] don't show "server doesn't respond" while in queue
Send all clients in the queue every game-day a packet that they are still in the queue.pull/8766/head
parent
8d199b1bbc
commit
13889b6554
|
@ -1873,6 +1873,21 @@ void NetworkServer_Tick(bool send_frame)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case NetworkClientSocket::STATUS_MAP_WAIT:
|
||||||
|
/* Send every two seconds a packet to the client, to make sure
|
||||||
|
* he knows the server is still there; just someone else is
|
||||||
|
* still receiving the map. */
|
||||||
|
if (std::chrono::steady_clock::now() > cs->last_packet + std::chrono::seconds(2)) {
|
||||||
|
cs->SendWait();
|
||||||
|
/* We need to reset the timer, as otherwise we will be
|
||||||
|
* spamming the client. Strictly speaking this variable
|
||||||
|
* tracks when we last received a packet from the client,
|
||||||
|
* but as he is waiting, he will not send us any till we
|
||||||
|
* start sending him data. */
|
||||||
|
cs->last_packet = std::chrono::steady_clock::now();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case NetworkClientSocket::STATUS_MAP:
|
case NetworkClientSocket::STATUS_MAP:
|
||||||
/* Downloading the map... this is the amount of time since starting the saving. */
|
/* Downloading the map... this is the amount of time since starting the saving. */
|
||||||
if (lag > _settings_client.network.max_download_time) {
|
if (lag > _settings_client.network.max_download_time) {
|
||||||
|
@ -1902,11 +1917,6 @@ void NetworkServer_Tick(bool send_frame)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NetworkClientSocket::STATUS_MAP_WAIT:
|
|
||||||
/* This is an internal state where we do not wait
|
|
||||||
* on the client to move to a different state. */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NetworkClientSocket::STATUS_END:
|
case NetworkClientSocket::STATUS_END:
|
||||||
/* Bad server/code. */
|
/* Bad server/code. */
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
|
|
|
@ -43,7 +43,6 @@ protected:
|
||||||
NetworkRecvStatus SendCompanyInfo();
|
NetworkRecvStatus SendCompanyInfo();
|
||||||
NetworkRecvStatus SendNewGRFCheck();
|
NetworkRecvStatus SendNewGRFCheck();
|
||||||
NetworkRecvStatus SendWelcome();
|
NetworkRecvStatus SendWelcome();
|
||||||
NetworkRecvStatus SendWait();
|
|
||||||
NetworkRecvStatus SendNeedGamePassword();
|
NetworkRecvStatus SendNeedGamePassword();
|
||||||
NetworkRecvStatus SendNeedCompanyPassword();
|
NetworkRecvStatus SendNeedCompanyPassword();
|
||||||
|
|
||||||
|
@ -82,6 +81,7 @@ public:
|
||||||
|
|
||||||
void CheckNextClientToSendMap(NetworkClientSocket *ignore_cs = nullptr);
|
void CheckNextClientToSendMap(NetworkClientSocket *ignore_cs = nullptr);
|
||||||
|
|
||||||
|
NetworkRecvStatus SendWait();
|
||||||
NetworkRecvStatus SendMap();
|
NetworkRecvStatus SendMap();
|
||||||
NetworkRecvStatus SendErrorQuit(ClientID client_id, NetworkErrorCode errorno);
|
NetworkRecvStatus SendErrorQuit(ClientID client_id, NetworkErrorCode errorno);
|
||||||
NetworkRecvStatus SendQuit(ClientID client_id);
|
NetworkRecvStatus SendQuit(ClientID client_id);
|
||||||
|
|
Loading…
Reference in New Issue