Locked chat function from double entry.

This commit is contained in:
Marat Fayzullin 2023-11-23 21:03:46 -05:00
parent a6dfbd31b0
commit 0d22dbe9a3
1 changed files with 26 additions and 24 deletions

View File

@ -35,6 +35,7 @@ class ClientRegistry(object):
self.chat = {}
self.chatCount = 1
self.chatColors = ColorCache()
self.chatLock = threading.Lock()
Config.get().wireProperty("max_clients", self._checkClientCount)
super().__init__()
@ -71,6 +72,7 @@ class ClientRegistry(object):
# Broadcast chat message to all connected clients.
def broadcastChatMessage(self, client, text: str, name: str = None):
with self.chatLock:
if name is not None:
# Names can only include alphanumerics
name = re.sub("\W+", "", name)