]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Avoid wrapping back to the first three UDP ports when assigning ports using nextFreeU...
authorMike Brady <mikebrady@eircom.net>
Fri, 11 Jan 2019 10:42:17 +0000 (10:42 +0000)
committerMike Brady <mikebrady@eircom.net>
Fri, 11 Jan 2019 10:42:17 +0000 (10:42 +0000)
common.c

index df3c2ca65dca08b28276ba640f34967392fb9145..05edae98f45447575cfeb4cdf344d46acba1413e 100644 (file)
--- 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;