[FIX] server.stop: avoid traceback during shutdown if HTTP service never started (e.g. because address was already in use)

bzr revid: odo@openerp.com-20140304093240-0yfoe3s0xz0u0xv9
This commit is contained in:
Olivier Dony 2014-03-04 10:32:40 +01:00
parent 9863dbe5c8
commit 4641a23d14
1 changed files with 3 additions and 2 deletions

View File

@ -285,8 +285,9 @@ class ThreadedServer(CommonServer):
_logger.info("Initiating shutdown")
_logger.info("Hit CTRL-C again or send a second signal to force the shutdown.")
self.httpd.shutdown()
self.close_socket(self.httpd.socket)
if self.httpd:
self.httpd.shutdown()
self.close_socket(self.httpd.socket)
# Manually join() all threads before calling sys.exit() to allow a second signal
# to trigger _force_quit() in case some non-daemon threads won't exit cleanly.