pep8 refactor netcheck
This commit is contained in:
parent
8f1df8c371
commit
abe1dde57e
@ -23,11 +23,14 @@ from utils import netutils
|
|||||||
from onionrutils import localcommand, epoch
|
from onionrutils import localcommand, epoch
|
||||||
from . import restarttor
|
from . import restarttor
|
||||||
def net_check(comm_inst):
|
def net_check(comm_inst):
|
||||||
'''Check if we are connected to the internet or not when we can't connect to any peers'''
|
'''Check if we are connected to the internet
|
||||||
rec = False # for detecting if we have received incoming connections recently
|
or not when we can't connect to any peers'''
|
||||||
|
# for detecting if we have received incoming connections recently
|
||||||
|
rec = False
|
||||||
if len(comm_inst.onlinePeers) == 0:
|
if len(comm_inst.onlinePeers) == 0:
|
||||||
try:
|
try:
|
||||||
if (epoch.get_epoch() - int(localcommand.local_command('/lastconnect'))) <= 60:
|
if (epoch.get_epoch() - int(localcommand.local_command
|
||||||
|
('/lastconnect'))) <= 60:
|
||||||
comm_inst.isOnline = True
|
comm_inst.isOnline = True
|
||||||
rec = True
|
rec = True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
Loading…
Reference in New Issue
Block a user