Merge branch 'develop' into asyncio

This commit is contained in:
Dan 2018-06-23 15:46:41 +02:00
commit 518d33ee7a

View File

@ -265,9 +265,6 @@ class Client(Methods, BaseClient):
self.is_started = False self.is_started = False
await self.session.stop() await self.session.stop()
def signal_handler(self, *args):
self.is_idle = False
def idle(self, stop_signals: tuple = (SIGINT, SIGTERM, SIGABRT)): def idle(self, stop_signals: tuple = (SIGINT, SIGTERM, SIGABRT)):
"""Blocks the program execution until one of the signals are received, """Blocks the program execution until one of the signals are received,
then gently stop the Client by closing the underlying connection. then gently stop the Client by closing the underlying connection.
@ -277,8 +274,11 @@ class Client(Methods, BaseClient):
Iterable containing signals the signal handler will listen to. Iterable containing signals the signal handler will listen to.
Defaults to (SIGINT, SIGTERM, SIGABRT). Defaults to (SIGINT, SIGTERM, SIGABRT).
""" """
def signal_handler(*args):
self.is_idle = False
for s in stop_signals: for s in stop_signals:
signal(s, self.signal_handler) signal(s, signal_handler)
self.is_idle = True self.is_idle = True