mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
control: mark signal handlers as private
This commit is contained in:
parent
74f68c2176
commit
bb2b57f9dd
@ -74,13 +74,13 @@ def shutdown(irc=None):
|
|||||||
|
|
||||||
# Done.
|
# Done.
|
||||||
|
|
||||||
def sigterm_handler(signo, stack_frame):
|
def _sigterm_handler(signo, stack_frame):
|
||||||
"""Handles SIGTERM and SIGINT gracefully by shutting down the PyLink daemon."""
|
"""Handles SIGTERM and SIGINT gracefully by shutting down the PyLink daemon."""
|
||||||
log.info("Shutting down on signal %s." % signo)
|
log.info("Shutting down on signal %s." % signo)
|
||||||
shutdown()
|
shutdown()
|
||||||
|
|
||||||
signal.signal(signal.SIGTERM, sigterm_handler)
|
signal.signal(signal.SIGTERM, _sigterm_handler)
|
||||||
signal.signal(signal.SIGINT, sigterm_handler)
|
signal.signal(signal.SIGINT, _sigterm_handler)
|
||||||
|
|
||||||
def rehash():
|
def rehash():
|
||||||
"""Rehashes the PyLink daemon."""
|
"""Rehashes the PyLink daemon."""
|
||||||
@ -139,10 +139,10 @@ def rehash():
|
|||||||
|
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
# Only register SIGHUP/SIGUSR1 on *nix.
|
# Only register SIGHUP/SIGUSR1 on *nix.
|
||||||
def sigusr1_handler(_signo, _stack_frame):
|
def _sigusr1_handler(_signo, _stack_frame):
|
||||||
"""Handles SIGUSR1 by rehashing the PyLink daemon."""
|
"""Handles SIGUSR1 by rehashing the PyLink daemon."""
|
||||||
log.info("SIGUSR1 received, reloading config.")
|
log.info("SIGUSR1 received, reloading config.")
|
||||||
rehash()
|
rehash()
|
||||||
|
|
||||||
signal.signal(signal.SIGUSR1, sigusr1_handler)
|
signal.signal(signal.SIGUSR1, _sigusr1_handler)
|
||||||
signal.signal(signal.SIGHUP, sigterm_handler)
|
signal.signal(signal.SIGHUP, _sigterm_handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user