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 <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2023-03-09 20:42:38 +01:00
parent 153e10f953
commit 4faa11a243

View file

@ -384,6 +384,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
if (mtu > ENET_PROTOCOL_MAXIMUM_MTU)
mtu = ENET_PROTOCOL_MAXIMUM_MTU;
if (mtu < peer -> mtu)
peer -> mtu = mtu;
if (host -> outgoingBandwidth == 0 &&