Connection lookups invalid data handling
- shouldn't throw an exception if argument is a string rather than Peer
This commit is contained in:
parent
f74f82e54f
commit
c9851b9f41
|
@ -65,12 +65,18 @@ class BMConnectionPool(object):
|
||||||
def getConnectionByAddr(self, addr):
|
def getConnectionByAddr(self, addr):
|
||||||
if addr in self.inboundConnections:
|
if addr in self.inboundConnections:
|
||||||
return self.inboundConnections[addr]
|
return self.inboundConnections[addr]
|
||||||
if addr.host in self.inboundConnections:
|
try:
|
||||||
return self.inboundConnections[addr.host]
|
if addr.host in self.inboundConnections:
|
||||||
|
return self.inboundConnections[addr.host]
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
if addr in self.outboundConnections:
|
if addr in self.outboundConnections:
|
||||||
return self.outboundConnections[addr]
|
return self.outboundConnections[addr]
|
||||||
if addr.host in self.udpSockets:
|
try:
|
||||||
return self.udpSockets[addr.host]
|
if addr.host in self.udpSockets:
|
||||||
|
return self.udpSockets[addr.host]
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
raise KeyError
|
raise KeyError
|
||||||
|
|
||||||
def isAlreadyConnected(self, nodeid):
|
def isAlreadyConnected(self, nodeid):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user