Commit a0fb33da authored by Guido van Rossum's avatar Guido van Rossum

Move close_storages() call to finally: clause in main().

Rephrase error message about address in use.
parent b6a12396
...@@ -202,12 +202,13 @@ class ZEOServer: ...@@ -202,12 +202,13 @@ class ZEOServer:
def main(self): def main(self):
self.check_socket() self.check_socket()
self.clear_socket() self.clear_socket()
try:
self.open_storages() self.open_storages()
self.setup_signals() self.setup_signals()
try:
self.create_server() self.create_server()
self.loop_forever() self.loop_forever()
finally: finally:
self.close_storages()
self.clear_socket() self.clear_socket()
def check_socket(self): def check_socket(self):
...@@ -221,7 +222,7 @@ class ZEOServer: ...@@ -221,7 +222,7 @@ class ZEOServer:
pass pass
else: else:
s.close() s.close()
self.opts.usage("address %r still in use" % self.opts.address) self.opts.usage("address %r already in use" % self.opts.address)
def clear_socket(self): def clear_socket(self):
if isinstance(self.opts.address, type("")): if isinstance(self.opts.address, type("")):
...@@ -293,12 +294,10 @@ class ZEOServer: ...@@ -293,12 +294,10 @@ class ZEOServer:
def handle_sigterm(self): def handle_sigterm(self):
info("terminated by SIGTERM") info("terminated by SIGTERM")
self.close_storages()
sys.exit(0) sys.exit(0)
def handle_sigint(self): def handle_sigint(self):
info("terminated by SIGINT") info("terminated by SIGINT")
self.close_storages()
sys.exit(0) sys.exit(0)
def handle_sigusr2(self): def handle_sigusr2(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment