}
D2Controller::~D2Controller() {
+ cerr << "dtor\n";
deregisterCommands();
}
+void
+D2Controller::d2ShutdownHandler() {
+ cerr << "shutting down\n";
+ deregisterCommands();
+
+ isc::data::ConstElementPtr args;
+ DControllerBase::shutdownHandler("shutdown", args);
+}
+
std::string
D2Controller::getVersionAddendum() {
std::stringstream stream;
}
has_command_channel_ = false;
+ // Assume that command manager was not destroyed first...
+
// Close the command socket (if it exists).
CommandMgr::instance().closeCommandSocket();
/// by convention this should match the executable name.
static const char* d2_bin_name_;
+ /// @brief handler for 'shutdown' command.
+ ///
+ /// This method handles shutdown command. It initiates the smooth shutdown
+ /// procedure using CPL methods.
+ void d2ShutdownHandler();
+
/// @brief Register commands.
void registerCommands();
#include <exceptions/exceptions.h>
#include <log/logger_support.h>
#include <log/logger_manager.h>
-
+#include <boost/pointer_cast.hpp>
#include <iostream>
using namespace isc::d2;
int main(int argc, char* argv[]) {
int ret = EXIT_SUCCESS;
+ // Instantiate/fetch the DHCP-DDNS application controller singleton.
+ DControllerBasePtr& controller = D2Controller::instance();
+
// Launch the controller passing in command line arguments.
// Exit program with the controller's return code.
try {
- // Instantiate/fetch the DHCP-DDNS application controller singleton.
- DControllerBasePtr& controller = D2Controller::instance();
-
// 'false' value disables test mode.
controller->launch(argc, argv, false);
} catch (const VersionMessage& ex) {
ret = EXIT_FAILURE;
}
+ boost::dynamic_pointer_cast<D2Controller>(controller)->d2ShutdownHandler();
+
return (ret);
}