From: Mike Brady Date: Fri, 11 Jan 2019 10:42:17 +0000 (+0000) Subject: Avoid wrapping back to the first three UDP ports when assigning ports using nextFreeU... X-Git-Tag: 3.3RC0~66^2~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9d78c8af64f5e5af4a92fba3e616e3573c20142;p=thirdparty%2Fshairport-sync.git 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. --- diff --git a/common.c b/common.c index df3c2ca6..05edae98 100644 --- a/common.c +++ b/common.c @@ -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;