From c0707a10f9007f6588f6a88ee2fe3758774e59f5 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 8 Nov 2018 23:22:43 -0600 Subject: [PATCH] fixed offline error --- onionr/api.py | 3 +++ onionr/communicator2.py | 5 ++++- onionr/onionrdaemontools.py | 2 +- onionr/static-data/default-plugins/pms/main.py | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/onionr/api.py b/onionr/api.py index a8a3b29e..3efc11b8 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -37,6 +37,9 @@ class API: ''' Validate that the client token matches the given token ''' + if len(self.clientToken) == 0: + logger.error("client password needs to be set") + return False try: if not hmac.compare_digest(self.clientToken, token): return False diff --git a/onionr/communicator2.py b/onionr/communicator2.py index 7f5f81fe..f29e482e 100755 --- a/onionr/communicator2.py +++ b/onionr/communicator2.py @@ -147,10 +147,13 @@ class OnionrCommunicatorDaemon: newBlocks = '' existingBlocks = self._core.getBlockList() triedPeers = [] # list of peers we've tried this time around + maxBacklog = 1560 # Max amount of *new* block hashes to have already in queue, to avoid memory exhaustion for i in range(tryAmount): - # check if disk allocation is used + if len(self.blockQueue) >= maxBacklog: + break if not self.isOnline: break + # check if disk allocation is used if self._core._utils.storageCounter.isFull(): logger.debug('Not looking up new blocks due to maximum amount of allowed disk space used') break diff --git a/onionr/onionrdaemontools.py b/onionr/onionrdaemontools.py index 71a89410..486f4638 100644 --- a/onionr/onionrdaemontools.py +++ b/onionr/onionrdaemontools.py @@ -59,7 +59,7 @@ class DaemonTools: def netCheck(self): '''Check if we are connected to the internet or not when we can't connect to any peers''' - if len(self.daemon.onlinePeers) != 0: + if len(self.daemon.onlinePeers) == 0: if not self.daemon._core._utils.checkNetwork(torPort=self.daemon.proxyPort): logger.warn('Network check failed, are you connected to the internet?') self.daemon.isOnline = False diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index 6e7dda24..d05ff36f 100644 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -136,6 +136,7 @@ class OnionrMail: cancel = logger.readline('Press enter to continue to message, or -q to not open the message (recommended).') if cancel != '-q': print(draw_border(self.myCore._utils.escapeAnsi(readBlock.bcontent.decode().strip()))) + input("Press enter to continue") return def sentbox(self):