linting refactoring communicator(utils) and reduced TOCTOU issus with online peer picking
This commit is contained in:
parent
9fbee668aa
commit
e5f3866f9e
8 changed files with 88 additions and 45 deletions
|
@ -45,8 +45,11 @@ def upload_blocks_from_communicator(comm_inst: OnionrCommunicatorDaemon):
|
|||
comm_inst.decrementThreadCount(TIMER_NAME)
|
||||
return
|
||||
session = session_manager.add_session(bl)
|
||||
for i in range(min(len(comm_inst.onlinePeers), 6)):
|
||||
peer = onlinepeers.pick_online_peer(comm_inst)
|
||||
for _ in range(min(len(comm_inst.onlinePeers), 6)):
|
||||
try:
|
||||
peer = onlinepeers.pick_online_peer(comm_inst)
|
||||
except onionrexceptions.OnlinePeerNeeded:
|
||||
continue
|
||||
try:
|
||||
session.peer_exists[peer]
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue