Prevent close server process to be started twice

Fix #652
pull/712/head
Julien Duponchelle 8 years ago
parent 8352ff02a1
commit f93e443548
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -60,6 +60,7 @@ class WebServer:
self._start_time = time.time()
self._port_manager = PortManager(host)
self._running = False
self._closing = False
@staticmethod
def instance(host=None, port=None):
@ -92,6 +93,12 @@ class WebServer:
Cleanly shutdown the server.
"""
if not self._closing:
self._closing = True
else:
log.warning("Close is already in progress")
return
if self._handler:
yield from self._handler.finish_connections()
self._handler = None

Loading…
Cancel
Save