interest on remote modules, etc. If it raises an
exception, the server will be immediately stopped.
Parameter: None, Return: None
+ _shutdown_module: can be optionally defined for module-specific
+ finalization. This is called right before the
+ module CC session is stopped. If it raises an
+ exception, the server shutdown will still
+ continue.
+ Parameter: None, Return: None
"""
# Will be set to True when the server should stop and shut down.
# propagate it)
self._mod_cc.check_command(True)
+ self._shutdown_module()
self._mod_cc.send_stopping()
def _command_handler(self, cmd, args):
"""The default implementation of the module specific initialization"""
pass
+ def _shutdown_module(self):
+ """The default implementation of the module specific finalization"""
+ pass
+
def watch_fileno(self, fileno, rcallback=None, wcallback=None, \
xcallback=None):
"""Register the fileno for the internal select() call.
self.assertTrue(self.__server.shutdown)
self.assertEqual((0, None), isc.config.parse_answer(answer))
+ def test_run_with_shutdown_module(self):
+ """Check run() with module specific shutdown method."""
+ self.shutdown_called = False
+ def check_called():
+ self.shutdown_called = True
+ self.__server.__shutdown = True
+ self.__server._shutdown_module = check_called
+ self.assertEqual(0, self.__server.run('test'))
+ self.assertTrue(self.shutdown_called)
+
def test_other_command(self):
self.__server._mod_command_handler = self.__server.mod_command_handler
answer = self.__server._command_handler('other command', None)