From 74f68c2176fe04647299f50e35c3ad2c8a6fe0c4 Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 12 Jul 2017 21:50:20 -0700 Subject: [PATCH] control: mark rehash and shutdown as public --- coremods/control.py | 10 +++++----- coremods/corecommands.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/coremods/control.py b/coremods/control.py index e6bd1ed..64f3a45 100644 --- a/coremods/control.py +++ b/coremods/control.py @@ -21,7 +21,7 @@ def remove_network(ircobj): del world.networkobjects[ircobj.name] def _print_remaining_threads(): - log.debug('_shutdown(): Remaining threads: %s', ['%s/%s' % (t.name, t.ident) for t in threading.enumerate()]) + log.debug('shutdown(): Remaining threads: %s', ['%s/%s' % (t.name, t.ident) for t in threading.enumerate()]) def _remove_pid(): # Remove our pid file. @@ -47,7 +47,7 @@ def _kill_plugins(irc=None): atexit.register(_remove_pid) atexit.register(_kill_plugins) -def _shutdown(irc=None): +def shutdown(irc=None): """Shuts down the Pylink daemon.""" global tried_shutdown if tried_shutdown: # We froze on shutdown last time, so immediately abort. @@ -77,12 +77,12 @@ def _shutdown(irc=None): def sigterm_handler(signo, stack_frame): """Handles SIGTERM and SIGINT gracefully by shutting down the PyLink daemon.""" log.info("Shutting down on signal %s." % signo) - _shutdown() + shutdown() signal.signal(signal.SIGTERM, sigterm_handler) signal.signal(signal.SIGINT, sigterm_handler) -def _rehash(): +def rehash(): """Rehashes the PyLink daemon.""" log.info('Reloading PyLink configuration...') old_conf = conf.conf.copy() @@ -142,7 +142,7 @@ if os.name == 'posix': def sigusr1_handler(_signo, _stack_frame): """Handles SIGUSR1 by rehashing the PyLink daemon.""" log.info("SIGUSR1 received, reloading config.") - _rehash() + rehash() signal.signal(signal.SIGUSR1, sigusr1_handler) signal.signal(signal.SIGHUP, sigterm_handler) diff --git a/coremods/corecommands.py b/coremods/corecommands.py index ca245e5..d5a677f 100644 --- a/coremods/corecommands.py +++ b/coremods/corecommands.py @@ -67,7 +67,7 @@ def shutdown(irc, source, args): log.info('(%s) SHUTDOWN requested by "%s!%s@%s", exiting...', irc.name, u.nick, u.ident, u.host) - control._shutdown(irc=irc) + control.shutdown(irc=irc) @utils.add_cmd def load(irc, source, args): @@ -194,7 +194,7 @@ def rehash(irc, source, args): Note: plugins must be manually reloaded.""" permissions.checkPermissions(irc, source, ['core.rehash']) try: - control._rehash() + control.rehash() except Exception as e: # Something went wrong, abort. log.exception("Error REHASHing config: ") irc.reply("Error loading configuration file: %s: %s" % (type(e).__name__, e))