Fix stop() not working and preserve a SystemExit

This commit is contained in:
Kovid Goyal 2015-05-27 09:16:02 +05:30
parent e61c0bc92b
commit 700e1996c8

View File

@ -334,11 +334,13 @@ class ServerLoop(object):
self.ready = True
self.log('calibre server listening on', ba)
while True:
while self.ready:
try:
self.tick()
except (KeyboardInterrupt, SystemExit):
except (KeyboardInterrupt, SystemExit) as e:
self.shutdown()
if isinstance(e, SystemExit):
raise
break
except:
self.log.exception('Error in ServerLoop.tick')