Fix bug involving runcheck
parent
0a7c3aeaab
commit
7973d7c8a6
|
@ -136,7 +136,7 @@ class API:
|
|||
if action == 'hello':
|
||||
resp = Response('Hello, World! ' + request.host)
|
||||
elif action == 'shutdown':
|
||||
request.environ.get('werkzeug.server.shutdown')()
|
||||
# request.environ.get('werkzeug.server.shutdown')()
|
||||
resp = Response('Goodbye')
|
||||
elif action == 'ping':
|
||||
resp = Response('pong')
|
||||
|
|
|
@ -114,8 +114,9 @@ class OnionrCommunicate:
|
|||
elif command[0] == 'runCheck':
|
||||
logger.info('Status check; looks good.')
|
||||
open('data/.runcheck', 'w+').close()
|
||||
break
|
||||
|
||||
apiRunningCheckCount += 1
|
||||
|
||||
# check if local API is up
|
||||
if apiRunningCheckCount > apiRunningCheckRate:
|
||||
if self._core._utils.localCommand('ping') != 'pong':
|
||||
|
@ -131,6 +132,7 @@ class OnionrCommunicate:
|
|||
apiRunningCheckCount = 0
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
self._netController.killTor()
|
||||
return
|
||||
|
||||
|
|
|
@ -400,7 +400,8 @@ class OnionrUtils:
|
|||
retData = row[0]
|
||||
return retData
|
||||
|
||||
def isCommunicatorRunning(timeout = 5, interval = 0.1):
|
||||
def isCommunicatorRunning(self, timeout = 5, interval = 0.1):
|
||||
try:
|
||||
runcheck_file = 'data/.runcheck'
|
||||
|
||||
if os.path.isfile(runcheck_file):
|
||||
|
@ -416,5 +417,7 @@ class OnionrUtils:
|
|||
os.remove(runcheck_file)
|
||||
|
||||
return True
|
||||
elif starttime - time.time() >= timeout:
|
||||
elif time.time() - starttime >= timeout:
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue