diff options
author | Rubidium <rubidium@openttd.org> | 2021-04-18 14:49:39 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-04-25 21:27:54 +0200 |
commit | d6000c2ec5f61c599d8859b981f2dac6a92e0755 (patch) | |
tree | 41418504a0c6e9701295228873bfc2c6d66fe313 /src/network/network_content.cpp | |
parent | 8b302761d4ca51f41eaff4097c9afa4f3aec5ec5 (diff) | |
download | openttd-d6000c2ec5f61c599d8859b981f2dac6a92e0755.tar.xz |
Codechange: differentiate between UDP, TCP and compatibility MTU values
Diffstat (limited to 'src/network/network_content.cpp')
-rw-r--r-- | src/network/network_content.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 529225235..fb95ff72b 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -221,9 +221,9 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con * A packet begins with the packet size and a byte for the type. * Then this packet adds a uint16 for the count in this packet. * The rest of the packet can be used for the IDs. */ - uint p_count = std::min<uint>(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); + uint p_count = std::min<uint>(count, (COMPAT_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); - Packet *p = new Packet(PACKET_CONTENT_CLIENT_INFO_ID); + Packet *p = new Packet(PACKET_CONTENT_CLIENT_INFO_ID, COMPAT_MTU); p->Send_uint16(p_count); for (uint i = 0; i < p_count; i++) { @@ -248,7 +248,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo this->Connect(); assert(cv->size() < 255); - assert(cv->size() < (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) / + assert(cv->size() < (COMPAT_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) / (sizeof(uint8) + sizeof(uint32) + (send_md5sum ? /*sizeof(ContentInfo::md5sum)*/16 : 0))); Packet *p = new Packet(send_md5sum ? PACKET_CONTENT_CLIENT_INFO_EXTID_MD5 : PACKET_CONTENT_CLIENT_INFO_EXTID); @@ -363,7 +363,7 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(const Co * A packet begins with the packet size and a byte for the type. * Then this packet adds a uint16 for the count in this packet. * The rest of the packet can be used for the IDs. */ - uint p_count = std::min<uint>(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); + uint p_count = std::min<uint>(count, (COMPAT_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); Packet *p = new Packet(PACKET_CONTENT_CLIENT_CONTENT); p->Send_uint16(p_count); |