fixed offline error

This commit is contained in:
Kevin Froman 2018-11-08 23:22:43 -06:00
parent 6f72e8c06c
commit c0707a10f9
4 changed files with 9 additions and 2 deletions

View File

@ -37,6 +37,9 @@ class API:
''' '''
Validate that the client token matches the given token 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: try:
if not hmac.compare_digest(self.clientToken, token): if not hmac.compare_digest(self.clientToken, token):
return False return False

View File

@ -147,10 +147,13 @@ class OnionrCommunicatorDaemon:
newBlocks = '' newBlocks = ''
existingBlocks = self._core.getBlockList() existingBlocks = self._core.getBlockList()
triedPeers = [] # list of peers we've tried this time around 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): for i in range(tryAmount):
# check if disk allocation is used if len(self.blockQueue) >= maxBacklog:
break
if not self.isOnline: if not self.isOnline:
break break
# check if disk allocation is used
if self._core._utils.storageCounter.isFull(): if self._core._utils.storageCounter.isFull():
logger.debug('Not looking up new blocks due to maximum amount of allowed disk space used') logger.debug('Not looking up new blocks due to maximum amount of allowed disk space used')
break break

View File

@ -59,7 +59,7 @@ class DaemonTools:
def netCheck(self): def netCheck(self):
'''Check if we are connected to the internet or not when we can't connect to any peers''' '''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): if not self.daemon._core._utils.checkNetwork(torPort=self.daemon.proxyPort):
logger.warn('Network check failed, are you connected to the internet?') logger.warn('Network check failed, are you connected to the internet?')
self.daemon.isOnline = False self.daemon.isOnline = False

View File

@ -136,6 +136,7 @@ class OnionrMail:
cancel = logger.readline('Press enter to continue to message, or -q to not open the message (recommended).') cancel = logger.readline('Press enter to continue to message, or -q to not open the message (recommended).')
if cancel != '-q': if cancel != '-q':
print(draw_border(self.myCore._utils.escapeAnsi(readBlock.bcontent.decode().strip()))) print(draw_border(self.myCore._utils.escapeAnsi(readBlock.bcontent.decode().strip())))
input("Press enter to continue")
return return
def sentbox(self): def sentbox(self):