Browse Source

protect for threading

David Rose 16 years ago
parent
commit
39a745bdaa
1 changed files with 4 additions and 2 deletions
  1. 4 2
      direct/src/distributed/ServerRepository.py

+ 4 - 2
direct/src/distributed/ServerRepository.py

@@ -302,8 +302,7 @@ class ServerRepository:
                 return task.cont
 
             # Crazy dereferencing
-            newConnection=newConnection.p()
-            self.qcr.addConnection(newConnection)
+            newConnection = newConnection.p()
 
             #  Add clients information to dictionary
             id = self.idAllocator.allocate()
@@ -315,6 +314,9 @@ class ServerRepository:
             client = self.Client(newConnection, netAddress, doIdBase)
             self.clientsByConnection[client.connection] = client
             self.clientsByDoIdBase[client.doIdBase] = client
+
+            # Now we can start listening to that new connection.
+            self.qcr.addConnection(newConnection)
             
             self.lastConnection = newConnection
             self.sendDoIdRange(client)