[Daemon] Make daemon port validator more precise

Previously, the validation was that the port is within the [1, 65535) range. Considering the defined range [17001, 18000) for the random port selector, it makes more sense to check that range instead.
This commit is contained in:
Alexander.Likhachev
2023-12-04 09:37:20 +01:00
committed by Space Team
parent 2c8501eb10
commit 209dbae893
@@ -63,7 +63,7 @@ fun walkDaemons(
.map { Pair(it, portExtractor(it.name)) }
.filter { (file, port) -> port != null && filter(file, port) }
.mapNotNull { (file, port) ->
assert(port!! in 1..<MAX_PORT_NUMBER)
assert(port!! in COMPILE_DAEMON_PORTS_RANGE_START..<COMPILE_DAEMON_PORTS_RANGE_END)
val relativeAge = fileToCompareTimestamp.lastModified() - file.lastModified()
report(DaemonReportCategory.DEBUG, "found daemon on port $port ($relativeAge ms old), trying to connect")
val daemon = tryConnectToDaemon(port, report)