Fix logic error in server duplicate check

This commit is contained in:
sfan5
2025-10-16 13:44:34 +02:00
parent 258add93e0
commit 2f66e1deca

View File

@@ -589,7 +589,7 @@ class Server:
self.updateCount = 1 self.updateCount = 1
self.meta["clients_top"] = self.totalClients = self.meta["clients"] self.meta["clients_top"] = self.totalClients = self.meta["clients"]
# check if this server is a logical duplicate of the other one. # check if *this* server is a logical duplicate of the other one
def is_duplicate(self, other: 'Server'): def is_duplicate(self, other: 'Server'):
if self.port == other.port and self.address.lower() == other.address.lower(): if self.port == other.port and self.address.lower() == other.address.lower():
# if everything matches it's not a duplicate but literally the same # if everything matches it's not a duplicate but literally the same
@@ -625,10 +625,11 @@ class ServerList:
i, server = self.getWithIndex(ip, port) i, server = self.getWithIndex(ip, port)
return server return server
def checkDuplicate(self, other_server): # returns true if the given server shouldn't be on the list
def checkDuplicate(self, other_server: Server):
with self.lock: with self.lock:
for server in self.list: for server in self.list:
if server.is_duplicate(other_server): if other_server.is_duplicate(server):
return True return True
return False return False