Codechange: encapsulate reading the size of a Packet
This commit is contained in:
@@ -247,7 +247,7 @@ Packet *ServerNetworkGameSocketHandler::ReceivePacket()
|
||||
/* We can receive a packet, so try that and if needed account for
|
||||
* the amount of received data. */
|
||||
Packet *p = this->NetworkTCPSocketHandler::ReceivePacket();
|
||||
if (p != nullptr) this->receive_limit -= p->size;
|
||||
if (p != nullptr) this->receive_limit -= p->Size();
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -1832,7 +1832,7 @@ void NetworkServer_Tick(bool send_frame)
|
||||
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
|
||||
/* We allow a number of bytes per frame, but only to the burst amount
|
||||
* to be available for packet receiving at any particular time. */
|
||||
cs->receive_limit = std::min<int>(cs->receive_limit + _settings_client.network.bytes_per_frame,
|
||||
cs->receive_limit = std::min<size_t>(cs->receive_limit + _settings_client.network.bytes_per_frame,
|
||||
_settings_client.network.bytes_per_frame_burst);
|
||||
|
||||
/* Check if the speed of the client is what we can expect from a client */
|
||||
|
Reference in New Issue
Block a user