1
0
Fork 0

Fix: [Network] Prevent stalling save game transfer when compression is slow

release/1.11
rubidium42 2021-04-25 17:53:24 +02:00 committed by Charles Pigott
parent ef48195ffa
commit f8f57ab46f
1 changed files with 5 additions and 3 deletions

View File

@ -605,7 +605,7 @@ void ServerNetworkGameSocketHandler::CheckNextClientToSendMap(NetworkClientSocke
/** This sends the map to the client */ /** This sends the map to the client */
NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap() NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
{ {
static uint sent_packets; // How many packets we did send successfully last time static uint16 sent_packets; // How many packets we did send successfully last time
if (this->status < STATUS_AUTHORIZED) { if (this->status < STATUS_AUTHORIZED) {
/* Illegal call, return error and ignore the packet */ /* Illegal call, return error and ignore the packet */
@ -665,8 +665,10 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
return NETWORK_RECV_STATUS_CONN_LOST; return NETWORK_RECV_STATUS_CONN_LOST;
case SPS_ALL_SENT: case SPS_ALL_SENT:
/* All are sent, increase the sent_packets */ /* All are sent, increase the sent_packets but do not overflow! */
if (has_packets) sent_packets *= 2; if (has_packets && sent_packets < std::numeric_limits<decltype(sent_packets)>::max() / 2) {
sent_packets *= 2;
}
break; break;
case SPS_PARTLY_SENT: case SPS_PARTLY_SENT: