progress removing onionr.py

master
Kevin Froman 2019-08-05 00:25:27 -05:00
parent 0690e9ca0e
commit cbe10f914a
6 changed files with 11 additions and 10 deletions

View File

@ -40,7 +40,6 @@ class PrivateAPI:
This initialization defines all of the API entry points and handlers for the endpoints and errors
This also saves the used host (random localhost IP address) to the data folder in host.txt
'''
time.sleep(0.3)
self.config = config
self.serializer = serializeddata.SerializedData()
self.startTime = epoch.get_epoch()

View File

@ -38,7 +38,6 @@ class PublicAPI:
The new client api server, isolated from the public api
'''
def __init__(self):
time.sleep(1)
app = flask.Flask('PublicAPI')
app.config['MAX_CONTENT_LENGTH'] = 5 * 1024 * 1024
self.i2pEnabled = config.get('i2p.host', False)

View File

@ -144,7 +144,7 @@ class OnionrCommunicatorDaemon:
if config.get('general.security_level', 1) == 0 and config.get('general.announce_node', True):
# Default to high security level incase config breaks
announceTimer = OnionrCommunicatorTimers(self, announcenode.announce_node, 3600, myArgs=[self], requiresPeer=True, maxThreads=1)
announceTimer.count = (announceTimer.frequency - 60)
announceTimer.count = (announceTimer.frequency - 120)
else:
logger.debug('Will not announce node.')

View File

@ -7,13 +7,13 @@ class FDSafeHandler(WSGIHandler):
self.timeout.start()
try:
WSGIHandler.handle(self)
except Exception:
self.handle_error()
except Exception as e:
self.handle_error(e)
finally:
self.timeout.close()
def handle_error(self):
if v is self.timeout:
def handle_error(self, two, three, four):
if two is self.timeout:
self.result = [b"Timeout"]
self.start_response("200 OK", [])
self.process_result()

View File

@ -100,7 +100,6 @@ class PrivateEndpoints:
try:
return Response(client_api._too_many.get(SerializedData).getStats())
except AttributeError as e:
print("damn", e)
pass
@private_endpoints_bp.route('/getuptime')

View File

@ -18,7 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import json
import json, time
from coredb import blockmetadb
import communicator
class SerializedData:
@ -35,7 +35,11 @@ class SerializedData:
def getStats(self):
'''Return statistics about our node'''
stats = {}
comm_inst = self._too_many.get(communicator.OnionrCommunicatorDaemon)
try:
self._too_many
except AttributeError:
time.sleep(1)
comm_inst = self._too_many.get(communicator.OnionrCommunicatorDaemon, args=(self._too_many,))
stats['uptime'] = comm_inst.getUptime()
stats['connectedNodes'] = '\n'.join(comm_inst.onlinePeers)
stats['blockCount'] = len(blockmetadb.get_block_list())