From 0d9e0c70665293449907d1f9c15a3e3023dc053b Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 1 May 2018 02:25:31 -0500 Subject: [PATCH] changed http server to gevent from flask built in --- onionr/api.py | 7 ++++++- onionr/onionr.py | 6 +++++- requirements.txt | 16 ++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/onionr/api.py b/onionr/api.py index dcf234b9..903a35c1 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -20,6 +20,7 @@ import flask from flask import request, Response, abort from multiprocessing import Process +from gevent.wsgi import WSGIServer import sys, random, threading, hmac, hashlib, base64, time, math, os, logger, config from core import Core @@ -256,7 +257,11 @@ class API: logger.info('Starting client on ' + self.host + ':' + str(bindPort) + '...', timestamp=True) 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: logger.error(str(e)) logger.fatal('Failed to start client on ' + self.host + ':' + str(bindPort) + ', exiting...') diff --git a/onionr/onionr.py b/onionr/onionr.py index 811e4487..96069c25 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -21,7 +21,11 @@ along with this program. If not, see . ''' -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 import api, core, config, logger, onionrplugins as plugins, onionrevents as events from onionrutils import OnionrUtils diff --git a/requirements.txt b/requirements.txt index 4ad9ff99..19564dad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 +gevent==1.2.2 +PyNaCl==1.2.1 +pycoin==0.62 +Flask==1.0 sha3==0.2.1 -PySocks==1.6.8 -bitpeer.py==0.4.7.5 +simple_crypt==4.1.7 +ecdsa==0.13 +requests==2.12.4 +nacl==0.0.0 +SocksiPy_branch==1.01 +sphinx_rtd_theme==0.3.0