don't connect to old peers. should reduce bandwidth used
authorForrest Voight <forrest.voight@gmail.com>
Sun, 25 Nov 2012 15:01:14 +0000 (10:01 -0500)
committerForrest Voight <forrest.voight@gmail.com>
Mon, 26 Nov 2012 01:49:54 +0000 (20:49 -0500)
p2pool/p2p.py
p2pool/util/p2protocol.py

index 38ddfed..b2d6e22 100644 (file)
@@ -118,7 +118,7 @@ class Protocol(p2protocol.Protocol):
     def handle_version(self, version, services, addr_to, addr_from, nonce, sub_version, mode, best_share_hash):
         if self.other_version is not None:
             raise PeerMisbehavingError('more than one version message')
-        if version < 4:
+        if version < 8:
             raise PeerMisbehavingError('peer too old')
         
         self.other_version = version
index 979a10f..e3f83a2 100644 (file)
@@ -76,7 +76,8 @@ class Protocol(protocol.Protocol):
                 print 'no handler for', repr(command)
             return
         
-        handler(**payload2)
+        if getattr(self, 'connected', True) and not getattr(self, 'disconnecting', False):
+            handler(**payload2)
     
     def badPeerHappened(self):
         self.transport.loseConnection()