pep8 refactor netcheck
This commit is contained in:
		
							parent
							
								
									8f1df8c371
								
							
						
					
					
						commit
						abe1dde57e
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -23,11 +23,14 @@ from utils import netutils
 | 
			
		|||
from onionrutils import localcommand, epoch
 | 
			
		||||
from . import restarttor
 | 
			
		||||
def net_check(comm_inst):
 | 
			
		||||
    '''Check if we are connected to the internet or not when we can't connect to any peers'''
 | 
			
		||||
    rec = False # for detecting if we have received incoming connections recently
 | 
			
		||||
    '''Check if we are connected to the internet
 | 
			
		||||
    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:
 | 
			
		||||
        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
 | 
			
		||||
                rec = True
 | 
			
		||||
        except ValueError:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue