Avoid wrapping back to the first three UDP ports when assigning ports using nextFreeUDPPort because the call resetFreeUDPPorts, called when not interrupting an existing session, will assign the first three ports without checking (or knowing) if they were recently in use.

This commit is contained in:
Mike Brady
2019-01-11 10:42:17 +00:00
parent 2ca6e42b62
commit b9d78c8af6
+1 -1
View File
@@ -114,7 +114,7 @@ uint16_t nextFreeUDPPort() {
if (UDPPortIndex == 0)
UDPPortIndex = config.udp_port_base;
else if (UDPPortIndex == (config.udp_port_base + config.udp_port_range - 1))
UDPPortIndex = config.udp_port_base;
UDPPortIndex = config.udp_port_base + 3; // avoid wrapping back to the first three, as they can be assigned by resetFreeUDPPort without checking
else
UDPPortIndex++;
return UDPPortIndex;