Ensure minimum port range

This commit is contained in:
nathan 2020-08-14 22:42:25 +02:00
parent 8857d1d016
commit f891e76478

View File

@ -27,7 +27,7 @@ class PortAllocator(basePort: Int, numberOfPortsToAllocate: Int) {
} }
minPort = basePort minPort = basePort
maxPort = basePort + (numberOfPortsToAllocate - 1) maxPort = Math.max(basePort+1, basePort + (numberOfPortsToAllocate - 1))
if (maxPort !in (basePort + 1)..65535) { if (maxPort !in (basePort + 1)..65535) {
throw IllegalArgumentException("Uppermost port $maxPort must be in the range [$basePort, 65535]") throw IllegalArgumentException("Uppermost port $maxPort must be in the range [$basePort, 65535]")