Commit 87659599 authored by Denis Bilenko's avatar Denis Bilenko

server: rename kill() method to close()

"kill" is available as a deprecated alias
parent aa5286a9
......@@ -154,7 +154,7 @@ class BaseServer(object):
self.kill()
raise
def kill(self):
def close(self):
"""Close the listener socket and stop accepting."""
self.started = False
try:
......@@ -167,6 +167,8 @@ class BaseServer(object):
self.__dict__.pop('socket', None)
self.__dict__.pop('handle', None)
kill = close # this is deprecated
def stop(self, timeout=None):
"""Stop accepting the connections and close the listening socket.
......
......@@ -78,15 +78,17 @@ class StreamServer(BaseServer):
if self.pool is not None:
self.pool._semaphore.rawlink(self._start_accepting_if_started)
def kill(self):
def close(self):
try:
BaseServer.kill(self)
BaseServer.close(self)
finally:
self.__dict__.pop('_handle', None)
pool = getattr(self, 'pool', None)
if pool is not None:
pool._semaphore.unlink(self._start_accepting_if_started)
kill = close # this is deprecated
def pre_start(self):
BaseServer.pre_start(self)
# make SSL work:
......@@ -138,7 +140,7 @@ class StreamServer(BaseServer):
self.loop.handle_error((address, self), *sys.exc_info())
ex = sys.exc_info()[1]
if self.is_fatal_error(ex):
self.kill()
self.close()
sys.stderr.write('ERROR: %s failed with %s\n' % (self, str(ex) or repr(ex)))
return
if self.delay >= 0:
......
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