* made api servers lint compliant
* made bigbrother lint compliant
This commit is contained in:
parent
9571ea519d
commit
1019ff0773
7 changed files with 106 additions and 78 deletions
|
@ -54,7 +54,7 @@ def get_online_peers(comm_inst: 'OnionrCommunicatorDaemon'):
|
|||
else:
|
||||
if len(comm_inst.onlinePeers) == 0:
|
||||
logger.debug('Couldn\'t connect to any peers.' +
|
||||
f' Last node seen {last_seen} ago.')
|
||||
f' Last node seen {last_seen} ago.')
|
||||
else:
|
||||
comm_inst.lastNodeSeen = time.time()
|
||||
comm_inst.decrementThreadCount('get_online_peers')
|
||||
|
|
|
@ -34,10 +34,10 @@ def pick_online_peer(comm_inst):
|
|||
|
||||
try:
|
||||
# Get a random online peer, securely.
|
||||
# May get stuck in loop if network is lost or if all peers in pool magically disconnect at once
|
||||
# May get stuck in loop if network is lost
|
||||
ret_data = comm_inst.onlinePeers[secrets.randbelow(peer_length)]
|
||||
except IndexError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
return ret_data
|
||||
return ret_data
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
'''
|
||||
Onionr - Private P2P Communication
|
||||
"""Onionr - Private P2P Communication.
|
||||
|
||||
remove an online peer from the pool in a communicator instance
|
||||
'''
|
||||
'''
|
||||
remove an online peer from the pool in a communicator instance
|
||||
"""
|
||||
"""
|
||||
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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -16,9 +15,11 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
def remove_online_peer(comm_inst, peer):
|
||||
'''Remove an online peer'''
|
||||
"""Remove an online peer."""
|
||||
try:
|
||||
del comm_inst.connectTimes[peer]
|
||||
except KeyError:
|
||||
|
@ -30,4 +31,4 @@ def remove_online_peer(comm_inst, peer):
|
|||
try:
|
||||
comm_inst.onlinePeers.remove(peer)
|
||||
except ValueError:
|
||||
pass
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue