From 2958034ad461e39b2e7da1be6da69e5fdff2616c Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 7 Oct 2021 17:04:32 -0400 Subject: [PATCH] more ip conversion --- src/Server/AllServers.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Server/AllServers.ts b/src/Server/AllServers.ts index 9b76fb46b..7a7883c5d 100644 --- a/src/Server/AllServers.ts +++ b/src/Server/AllServers.ts @@ -89,15 +89,15 @@ export function createUniqueRandomIp(): string { // Saftely add a Server to the AllServers map export function AddToAllServers(server: Server | HacknetServer): void { - const serverIp = server.ip; - if (ipExists(serverIp)) { - console.warn(`IP of server that's being added: ${serverIp}`); + if (GetServer(server.hostname)) { + console.warn(`IP of server that's being added: ${server.ip}`); console.warn(`Hostname of the server thats being added: ${server.hostname}`); - console.warn(`The server that already has this IP is: ${AllServers[serverIp].hostname}`); + console.warn(`The server that already has this IP is: ${AllServers[server.hostname].hostname}`); throw new Error("Error: Trying to add a server with an existing IP"); } - AllServers[serverIp] = server; + console.log(`adding ${server.hostname}`); + AllServers[server.hostname] = server; } interface IServerParams {