Fixed some broken things from communicator decoupling
This commit is contained in:
parent
bff2595ac9
commit
96af4e8db0
9 changed files with 14 additions and 13 deletions
|
@ -113,7 +113,7 @@ class OnionrCommunicatorDaemon:
|
|||
# Timer to discover new peers
|
||||
OnionrCommunicatorTimers(
|
||||
self, lookupadders.lookup_new_peer_transports_with_communicator,
|
||||
60, requires_peer=True, my_args=[self], max_threads=2)
|
||||
60, requires_peer=True, my_args=[shared_state], max_threads=2)
|
||||
|
||||
# Timer for adjusting which peers
|
||||
# we actively communicate to at any given time,
|
||||
|
|
|
@ -26,9 +26,8 @@ if TYPE_CHECKING:
|
|||
"""
|
||||
|
||||
|
||||
def pick_online_peer(comm_inst):
|
||||
def pick_online_peer(kv: 'DeadSimpleKV'):
|
||||
"""Randomly picks peer from pool without bias (using secrets module)."""
|
||||
kv: "DeadSimpleKV" = comm_inst.shared_state.get_by_string("DeadSimpleKV")
|
||||
ret_data = ''
|
||||
peer_length = len(kv.get('onlinePeers'))
|
||||
if peer_length <= 0:
|
||||
|
|
|
@ -11,6 +11,7 @@ from coredb import keydb
|
|||
from . import onlinepeers
|
||||
from onionrtypes import OnionAddressString
|
||||
from onionrpeers.peerprofiles import PeerProfiles
|
||||
from etc.waitforsetvar import wait_for_set_var
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,10 +34,10 @@ def get_peer_profile(kv, address: OnionAddressString) -> 'PeerProfiles':
|
|||
if profile.address == address:
|
||||
return profile
|
||||
p = PeerProfiles(address)
|
||||
profile_inst_list.append(p)
|
||||
return p
|
||||
|
||||
|
||||
|
||||
def peer_action(shared_state, peer, action,
|
||||
returnHeaders=False, max_resp_size=5242880):
|
||||
"""Perform a get request to a peer."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue