hopefully issues with keyboardinterrupt

This commit is contained in:
Kevin Froman 2018-07-07 19:26:01 -05:00
parent 8727dc2241
commit 31236eea84
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B

View File

@ -68,7 +68,7 @@ class OnionrCommunicatorDaemon:
OnionrCommunicatorTimers(self, self.heartbeat, 10) OnionrCommunicatorTimers(self, self.heartbeat, 10)
# Initalize peer online list # Initalize peer online list
logger.debug('Onionr is not yet ready to recieve commands.') logger.warn('Onionr is starting up and is not yet ready to recieve commands.')
self.getOnlinePeers() self.getOnlinePeers()
# Print nice header thing :) # Print nice header thing :)
@ -86,15 +86,20 @@ class OnionrCommunicatorDaemon:
OnionrCommunicatorTimers(self, self.lookupAdders, 600) OnionrCommunicatorTimers(self, self.lookupAdders, 600)
# Main daemon loop, mainly for calling timers, don't do any complex operations here to avoid locking # Main daemon loop, mainly for calling timers, don't do any complex operations here to avoid locking
while not self.shutdown: try:
for i in self.timers: while not self.shutdown:
if self.shutdown: for i in self.timers:
break if self.shutdown:
i.processTimer() break
time.sleep(self.delay) i.processTimer()
time.sleep(self.delay)
except KeyboardInterrupt:
self.shutdown = True
pass
logger.info('Goodbye.') logger.info('Goodbye.')
self._core._utils.localCommand('shutdown') self._core._utils.localCommand('shutdown')
time.sleep(0.5)
def lookupKeys(self): def lookupKeys(self):
'''Lookup new keys''' '''Lookup new keys'''
@ -399,8 +404,5 @@ except IndexError:
if shouldRun: if shouldRun:
try: try:
OnionrCommunicatorDaemon(debug, developmentMode) OnionrCommunicatorDaemon(debug, developmentMode)
except KeyboardInterrupt:
sys.exit(1)
pass
except Exception as e: except Exception as e:
logger.error('Error occured in Communicator', error = e, timestamp = False) logger.error('Error occured in Communicator', error = e, timestamp = False)