PyBitmessage/src/network/connectionchooser.py

12 lines
255 B
Python
Raw Normal View History

import random
from bmconfigparser import BMConfigParser
import knownnodes
import state
def chooseConnection(stream):
if state.trustedPeer:
return state.trustedPeer
else:
return random.choice(knownnodes.knownNodes[stream].keys())