Peer discovery fixes
- incoming packets weren't correctly processed
This commit is contained in:
parent
d9e4f2ceb8
commit
0324958e92
|
@ -8,7 +8,7 @@ import state
|
|||
|
||||
def getDiscoveredPeer(stream):
|
||||
try:
|
||||
peer = random.choice(state.discoveredPeers.keys())
|
||||
return random.choice(state.discoveredPeers.keys())
|
||||
except (IndexError, KeyError):
|
||||
raise ValueError
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ class BMConnectionPool(object):
|
|||
return self.inboundConnections[addr.host]
|
||||
if addr in self.outboundConnections:
|
||||
return self.outboundConnections[addr]
|
||||
if addr in self.udpSockets:
|
||||
return self.udpSockets[addr]
|
||||
if addr.host in self.udpSockets:
|
||||
return self.udpSockets[addr.host]
|
||||
raise KeyError
|
||||
|
||||
def isAlreadyConnected(self, nodeid):
|
||||
|
|
|
@ -100,7 +100,7 @@ class UDPSocket(BMProto):
|
|||
return True
|
||||
logger.debug("received peer discovery from %s:%i (port %i):", self.destination.host, self.destination.port, remoteport)
|
||||
if self.local:
|
||||
state.discoveredPeers[state.Peer(self.destination.host, remoteport)] = time.time
|
||||
state.discoveredPeers[state.Peer(self.destination.host, remoteport)] = time.time()
|
||||
return True
|
||||
|
||||
def bm_command_portcheck(self):
|
||||
|
@ -143,7 +143,7 @@ class UDPSocket(BMProto):
|
|||
# overwrite the old buffer to avoid mixing data and so that self.local works correctly
|
||||
self.read_buf = recdata
|
||||
self.bm_proto_reset()
|
||||
receiveDataQueue.put(self.destination)
|
||||
receiveDataQueue.put(self.listening)
|
||||
|
||||
def handle_write(self):
|
||||
try:
|
||||
|
|
Reference in New Issue
Block a user