CODEBASE: Replace ipExists() linear scan with O(1) Map.has() (#2621)

This commit is contained in:
Lee Stutzman
2026-04-03 03:13:35 +01:00
committed by GitHub
parent dc4ea8452c
commit d1b6acc57a
2 changed files with 36 additions and 6 deletions

View File

@@ -89,12 +89,7 @@ export const disconnectServers = (server1: BaseServer, server2: BaseServer) => {
};
export function ipExists(ip: string): boolean {
for (const server of AllServers.values()) {
if (server.ip === ip) {
return true;
}
}
return false;
return AllServers.has(ip);
}
export function createUniqueRandomIp(): IPAddress {