mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
CODEBASE: Replace ipExists() linear scan with O(1) Map.has() (#2621)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user