1. Arne Babenhauserheide
  2. basic-gnutella-python

Commits

Arne Babenhauserheide  committed a8abc3f

FIX: Died when all connections were dead.

  • Participants
  • Parent commits 727387c
  • Branches default

Comments (0)

Files changed (1)

File gnutella.py

View file
  • Ignore whitespace
     def stay_connected(self):
         """Keep the network connected."""
         new_packet_num = 0
-        for i in range(num_connections):
-            self.new_connection()
-        while True in [thread.is_alive() for thread in self.connections]:
+        while True:
+            # replace dead connections
             for t in [t for t in self.connections if not t.is_alive()]:
                 #print("dead")
                 self.connections.remove(t)