Commit 439e44ae authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3971] Catch exceptions in the CtrlDhcp{4,6}Srv destructors.

parent 747a83bf
...@@ -226,6 +226,7 @@ void ControlledDhcpv4Srv::shutdown() { ...@@ -226,6 +226,7 @@ void ControlledDhcpv4Srv::shutdown() {
} }
ControlledDhcpv4Srv::~ControlledDhcpv4Srv() { ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
try {
cleanup(); cleanup();
// Stop worker thread running timers, if it is running. // Stop worker thread running timers, if it is running.
...@@ -243,6 +244,12 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() { ...@@ -243,6 +244,12 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
CommandMgr::instance().deregisterCommand("statistic-reset-all"); CommandMgr::instance().deregisterCommand("statistic-reset-all");
CommandMgr::instance().deregisterCommand("statistic-remove-all"); CommandMgr::instance().deregisterCommand("statistic-remove-all");
} catch (...) {
// Don't want to throw exceptions from the destructor. The server
// is shutting down anyway.
;
}
server_ = NULL; // forget this instance. Noone should call any handlers at server_ = NULL; // forget this instance. Noone should call any handlers at
// this stage. // this stage.
} }
......
...@@ -222,6 +222,7 @@ void ControlledDhcpv6Srv::shutdown() { ...@@ -222,6 +222,7 @@ void ControlledDhcpv6Srv::shutdown() {
} }
ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
try {
cleanup(); cleanup();
// Stop worker thread running timers, if it is running. // Stop worker thread running timers, if it is running.
...@@ -239,6 +240,12 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { ...@@ -239,6 +240,12 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
CommandMgr::instance().deregisterCommand("statistic-reset-all"); CommandMgr::instance().deregisterCommand("statistic-reset-all");
CommandMgr::instance().deregisterCommand("statistic-remove-all"); CommandMgr::instance().deregisterCommand("statistic-remove-all");
} catch (...) {
// Don't want to throw exceptions from the destructor. The server
// is shutting down anyway.
;
}
server_ = NULL; // forget this instance. There should be no callback anymore server_ = NULL; // forget this instance. There should be no callback anymore
// at this stage anyway. // at this stage anyway.
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment