fixed broken shutdown command

This commit is contained in:
Kevin Froman 2018-05-02 20:14:00 -05:00
parent 98dac40139
commit 1a02124122
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 4 additions and 4 deletions

View File

@ -137,6 +137,7 @@ class API:
resp = Response('Hello, World! ' + request.host) resp = Response('Hello, World! ' + request.host)
elif action == 'shutdown': elif action == 'shutdown':
# request.environ.get('werkzeug.server.shutdown')() # request.environ.get('werkzeug.server.shutdown')()
self.http_server.stop()
resp = Response('Goodbye') resp = Response('Goodbye')
elif action == 'ping': elif action == 'ping':
resp = Response('pong') resp = Response('pong')
@ -151,7 +152,6 @@ class API:
self.mimeType = 'text/html' self.mimeType = 'text/html'
response = siteData.split(b'-', 2)[-1] response = siteData.split(b'-', 2)[-1]
resp = Response(response) resp = Response(response)
else: else:
resp = Response('(O_o) Dude what? (invalid command)') resp = Response('(O_o) Dude what? (invalid command)')
endTime = math.floor(time.time()) endTime = math.floor(time.time())
@ -257,8 +257,8 @@ class API:
logger.info('Starting client on ' + self.host + ':' + str(bindPort) + '...', timestamp=True) logger.info('Starting client on ' + self.host + ':' + str(bindPort) + '...', timestamp=True)
try: try:
http_server = WSGIServer((self.host, bindPort), app) self.http_server = WSGIServer((self.host, bindPort), app)
http_server.serve_forever() self.http_server.serve_forever()
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
#app.run(host=self.host, port=bindPort, debug=False, threaded=True) #app.run(host=self.host, port=bindPort, debug=False, threaded=True)

View File

@ -23,7 +23,7 @@
import sys import sys
if sys.version_info[0] == 2 or sys.version_info[1] < 5: if sys.version_info[0] == 2 or sys.version_info[1] < 5:
print('Error, Onionr requires Python 3.4.x+') print('Error, Onionr requires Python 3.4+')
sys.exit(1) sys.exit(1)
import os, base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re import os, base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re
from threading import Thread from threading import Thread