Merge pull request #3129 from InDieTasten/fix-unique-ip-generation

Fix unique ip generation
This commit is contained in:
hydroflame 2022-03-16 14:53:34 -04:00 committed by GitHub
commit 9a385dad34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,12 +78,11 @@ export function ipExists(ip: string): boolean {
}
export function createUniqueRandomIp(): string {
const ip = createRandomIp();
// If the Ip already exists, recurse to create a new one
if (ipExists(ip)) {
return createRandomIp();
}
let ip: string;
// Repeat generating ip, until unique one is found
do {
ip = createRandomIp();
} while (ipExists(ip));
return ip;
}