home · contact · privacy
Eliminate race condition of ClientEvents sent before NewClientEvent initialized Clien...
authorChristian Heller <c.heller@plomlompom.de>
Mon, 15 Sep 2025 20:55:12 +0000 (22:55 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 15 Sep 2025 20:55:12 +0000 (22:55 +0200)
ircplom/client.py
ircplom/client_tui.py

index ca851132aa4f200b575c1592a2cc91e013887f5a..8e8e760ea02b9920792e26380ea175edaae955dd 100644 (file)
@@ -733,9 +733,8 @@ class Client(ABC, ClientQueueMixin):
             setattr(self.db, k, getattr(conn_setup, k))
         if self.db.port <= 0:
             self.db.port = PORT_SSL
-        self._start_connecting()
 
-    def _start_connecting(self) -> None:
+    def start_connecting(self) -> None:
 
         def connect(self) -> None:
             try:
@@ -904,6 +903,7 @@ class NewClientEvent(AffectiveEvent):
 
     def affect(self, target: ClientsDb) -> None:
         target[self.payload.client_id] = self.payload
+        self.payload.start_connecting()
 
 
 @dataclass
index 6c35ccda57ffbe5b0fe58efd48c73d76a655eded..41887c658d67479cee945139c2fc2aa6e7a36477 100644 (file)
@@ -488,7 +488,7 @@ class ClientKnowingTui(Client):
             self._log('not re-connecting since already connected',
                       scope=LogScope.SAME, alert=True)
             return
-        self._start_connecting()
+        self.start_connecting()
 
     def _log(self, msg: str, scope: Optional[LogScope] = None, **kwargs
              ) -> None: