Merge pull request #147 from jjclark1982/patch-1

Only append one number to make unique hostname
This commit is contained in:
danielyxie 2017-10-11 21:01:45 -05:00 committed by GitHub
commit 5768068065

@ -15,12 +15,13 @@ function Server(ip=createRandomIp(), hostname="", organizationName="",
//Connection information
this.ip = ip;
var i = 0;
while (GetServerByHostname(hostname) != null) {
var suffix = "";
while (GetServerByHostname(hostname+suffix) != null) {
//Server already exists
hostname = hostname + "-" + i;
suffix = "-" + i;
++i;
}
this.hostname = hostname;
this.hostname = hostname + suffix;
this.organizationName = organizationName;
this.isConnectedTo = isConnectedTo; //Whether the player is connected to this server