diff --git a/src/Connection/Connection.py b/src/Connection/Connection.py index 4a7c6ab9..398a4cc3 100644 --- a/src/Connection/Connection.py +++ b/src/Connection/Connection.py @@ -167,7 +167,7 @@ class Connection(object): # Detect protocol event_connected = self.event_connected self.send({"cmd": "handshake", "req_id": 0, "params": self.getHandshakeInfo()}) - gevent.spawn(self.messageLoop) + self.server.outgoing_pool.spawn(self.messageLoop) connect_res = event_connected.get() # Wait for handshake if self.sock: self.sock.settimeout(timeout_before) diff --git a/src/Connection/ConnectionServer.py b/src/Connection/ConnectionServer.py index e7951321..03a93daa 100644 --- a/src/Connection/ConnectionServer.py +++ b/src/Connection/ConnectionServer.py @@ -79,6 +79,9 @@ class ConnectionServer(object): self.pool = Pool(500) # do not accept more than 500 connections self.managed_pools["incoming"] = self.pool + self.outgoing_pool = Pool(None) + self.managed_pools["outgoing"] = self.outgoing_pool + # Bittorrent style peerid self.peer_id = "-UT3530-%s" % CryptHash.random(12, "base64")