Use larger packets for server to client map/savegame transfer

This commit is contained in:
Jonathan G Rennison
2019-05-21 18:57:06 +01:00
parent dc357c9239
commit cb0ca43eae

View File

@@ -171,12 +171,12 @@ struct PacketWriter : SaveFilter {
byte *bufe = buf + size; byte *bufe = buf + size;
while (buf != bufe) { while (buf != bufe) {
size_t to_write = min(SEND_MTU - this->current->size, bufe - buf); size_t to_write = min(SHRT_MAX - this->current->size, bufe - buf);
memcpy(this->current->buffer + this->current->size, buf, to_write); memcpy(this->current->buffer + this->current->size, buf, to_write);
this->current->size += (PacketSize)to_write; this->current->size += (PacketSize)to_write;
buf += to_write; buf += to_write;
if (this->current->size == SEND_MTU) { if (this->current->size == SHRT_MAX) {
this->AppendQueue(); this->AppendQueue();
if (buf != bufe) this->current = new Packet(PACKET_SERVER_MAP_DATA); if (buf != bufe) this->current = new Packet(PACKET_SERVER_MAP_DATA);
} }