Immediately raise ValueError in connectionchooser.chooseConnection()
if have no nodes for given stream.
This commit is contained in:
parent
45508538aa
commit
bcc2ca7d33
|
@ -44,7 +44,10 @@ def chooseConnection(stream):
|
||||||
# discovered peers are already filtered by allowed streams
|
# discovered peers are already filtered by allowed streams
|
||||||
return getDiscoveredPeer()
|
return getDiscoveredPeer()
|
||||||
for _ in range(50):
|
for _ in range(50):
|
||||||
peer = random.choice(knownnodes.knownNodes[stream].keys())
|
try:
|
||||||
|
peer = random.choice(knownnodes.knownNodes[stream].keys())
|
||||||
|
except IndexError:
|
||||||
|
break
|
||||||
try:
|
try:
|
||||||
peer_info = knownnodes.knownNodes[stream][peer]
|
peer_info = knownnodes.knownNodes[stream][peer]
|
||||||
if peer_info.get('self'):
|
if peer_info.get('self'):
|
||||||
|
|
Reference in New Issue
Block a user