aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Sennhauser <[email protected]>2023-03-09 20:42:38 +0100
committerRalph Sennhauser <[email protected]>2023-03-10 09:41:55 +0100
commit4faa11a243d004d8a15d5353c693dbb487ddb613 (patch)
tree3a69b774bb04e070a8b5d9c0085e70aebf65f44a
parent153e10f953d949eebf262e90b72d56b2e1928ff7 (diff)
downloadenet-4faa11a243d004d8a15d5353c693dbb487ddb613.tar.gz
enet-4faa11a243d004d8a15d5353c693dbb487ddb613.zip
Fix MTU negotiation on server side
On connect the MTU sent by the client gets stored and sent back unchanged if within minimum and maximum of the protocol. Then on verify connect a test is done if the returned MTU is smaller than the current MTU and if so gets adjusted. So as long as the MTU is within boundaries only the client specified MTU is relevant. This patch adds a check for smaller MTU on server side. Signed-off-by: Ralph Sennhauser <[email protected]>
-rw-r--r--protocol.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/protocol.c b/protocol.c
index 9fc6adf..e38be63 100644
--- a/protocol.c
+++ b/protocol.c
@@ -384,7 +384,8 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
if (mtu > ENET_PROTOCOL_MAXIMUM_MTU)
mtu = ENET_PROTOCOL_MAXIMUM_MTU;
- peer -> mtu = mtu;
+ if (mtu < peer -> mtu)
+ peer -> mtu = mtu;
if (host -> outgoingBandwidth == 0 &&
peer -> incomingBandwidth == 0)