bug fixes and performence improvements

This commit is contained in:
Kevin Froman 2019-01-21 21:29:29 -06:00
parent 4d5e0aeb74
commit aef6d5d8e6
3 changed files with 16 additions and 8 deletions

View File

@ -218,7 +218,8 @@ class OnionrCommunicatorDaemon:
# if block does not exist on disk and is not already in block queue # if block does not exist on disk and is not already in block queue
if i not in self.blockQueue and not self._core._blacklist.inBlacklist(i): if i not in self.blockQueue and not self._core._blacklist.inBlacklist(i):
if onionrproofs.hashMeetsDifficulty(i): if onionrproofs.hashMeetsDifficulty(i):
self.blockQueue.append(i) # add blocks to download queue if len(self.blockQueue) <= 1000000:
self.blockQueue.append(i) # add blocks to download queue
self.decrementThreadCount('lookupBlocks') self.decrementThreadCount('lookupBlocks')
return return
@ -295,6 +296,8 @@ class OnionrCommunicatorDaemon:
if tempHash != 'ed55e34cb828232d6c14da0479709bfa10a0923dca2b380496e6b2ed4f7a0253': if tempHash != 'ed55e34cb828232d6c14da0479709bfa10a0923dca2b380496e6b2ed4f7a0253':
# Dumb hack for 404 response from peer. Don't log it if 404 since its likely not malicious or a critical error. # Dumb hack for 404 response from peer. Don't log it if 404 since its likely not malicious or a critical error.
logger.warn('Block hash validation failed for ' + blockHash + ' got ' + tempHash) logger.warn('Block hash validation failed for ' + blockHash + ' got ' + tempHash)
else:
removeFromQueue = False # Don't remove from queue if 404
if removeFromQueue: if removeFromQueue:
try: try:
self.blockQueue.remove(blockHash) # remove from block queue both if success or false self.blockQueue.remove(blockHash) # remove from block queue both if success or false

View File

@ -208,21 +208,26 @@ class OnionrMail:
# if -q or ctrl-c/d, exit function here, otherwise we successfully got the public key # if -q or ctrl-c/d, exit function here, otherwise we successfully got the public key
return return
logger.info('Enter your message, stop by entering -q on a new line.') cancelEnter = False
logger.info('Enter your message, stop by entering -q on a new line. -c to cancel')
while newLine != '-q': while newLine != '-q':
try: try:
newLine = input() newLine = input()
except (KeyboardInterrupt, EOFError): except (KeyboardInterrupt, EOFError):
pass cancelEnter = True
if newLine == '-c':
cancelEnter = True
break
if newLine == '-q': if newLine == '-q':
continue continue
newLine += '\n' newLine += '\n'
message += newLine message += newLine
logger.info('Inserting encrypted message as Onionr block....') if not cancelEnter:
logger.info('Inserting encrypted message as Onionr block....')
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True) blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True)
self.sentboxTools.addToSent(blockID, recip, message) self.sentboxTools.addToSent(blockID, recip, message)
def menu(self): def menu(self):
choice = '' choice = ''
while True: while True:

View File

@ -79,7 +79,7 @@
"peers" : { "peers" : {
"minimum_score" : -100, "minimum_score" : -100,
"max_stored_peers" : 5000, "max_stored_peers" : 5000,
"max_connect" : 50 "max_connect" : 1000
}, },
"timers" : { "timers" : {