Ignore self node in connectionchooser.chooseConnection()
This commit is contained in:
parent
7215003c6f
commit
bdb09c2d00
|
@ -1,3 +1,4 @@
|
||||||
|
# pylint: disable=too-many-branches
|
||||||
import random # nosec
|
import random # nosec
|
||||||
|
|
||||||
import knownnodes
|
import knownnodes
|
||||||
|
@ -38,7 +39,10 @@ def chooseConnection(stream):
|
||||||
for _ in range(50):
|
for _ in range(50):
|
||||||
peer = random.choice(knownnodes.knownNodes[stream].keys())
|
peer = random.choice(knownnodes.knownNodes[stream].keys())
|
||||||
try:
|
try:
|
||||||
rating = knownnodes.knownNodes[stream][peer]['rating']
|
peer_info = knownnodes.knownNodes[stream][peer]
|
||||||
|
if peer_info.get('self'):
|
||||||
|
continue
|
||||||
|
rating = peer_info["rating"]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
logger.warning('Error in %s', peer)
|
logger.warning('Error in %s', peer)
|
||||||
rating = 0
|
rating = 0
|
||||||
|
|
Reference in New Issue
Block a user