changed http server to gevent from flask built in

This commit is contained in:
Kevin Froman 2018-05-01 02:25:31 -05:00
parent a7244b2a0a
commit 0d9e0c7066
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
3 changed files with 21 additions and 8 deletions

View File

@ -20,6 +20,7 @@
import flask import flask
from flask import request, Response, abort from flask import request, Response, abort
from multiprocessing import Process from multiprocessing import Process
from gevent.wsgi import WSGIServer
import sys, random, threading, hmac, hashlib, base64, time, math, os, logger, config import sys, random, threading, hmac, hashlib, base64, time, math, os, logger, config
from core import Core from core import Core
@ -256,7 +257,11 @@ 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:
app.run(host=self.host, port=bindPort, debug=False, threaded=True) http_server = WSGIServer((self.host, bindPort), app)
http_server.serve_forever()
except KeyboardInterrupt:
pass
#app.run(host=self.host, port=bindPort, debug=False, threaded=True)
except Exception as e: except Exception as e:
logger.error(str(e)) logger.error(str(e))
logger.fatal('Failed to start client on ' + self.host + ':' + str(bindPort) + ', exiting...') logger.fatal('Failed to start client on ' + self.host + ':' + str(bindPort) + ', exiting...')

View File

@ -21,7 +21,11 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
''' '''
import sys, os, base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re import sys
if sys.version_info[0] == 2 or sys.version_info[1] < 5:
print('Error, Onionr requires Python 3.4.x+')
sys.exit(1)
import base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re
from threading import Thread from threading import Thread
import api, core, config, logger, onionrplugins as plugins, onionrevents as events import api, core, config, logger, onionrplugins as plugins, onionrevents as events
from onionrutils import OnionrUtils from onionrutils import OnionrUtils

View File

@ -1,8 +1,12 @@
PyNaCl==1.2.1
requests==2.12.4
Flask==0.12.2
simple_crypt==4.1.7
urllib3==1.19.1 urllib3==1.19.1
gevent==1.2.2
PyNaCl==1.2.1
pycoin==0.62
Flask==1.0
sha3==0.2.1 sha3==0.2.1
PySocks==1.6.8 simple_crypt==4.1.7
bitpeer.py==0.4.7.5 ecdsa==0.13
requests==2.12.4
nacl==0.0.0
SocksiPy_branch==1.01
sphinx_rtd_theme==0.3.0