diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-10-18 19:50:07 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-10-18 19:50:07 +0000 |
commit | db5c857339b5079d82901249af93bba2b960ee72 (patch) | |
tree | a3b4bbb02fb3d2909dac609cbe83138be6e51bd5 | |
parent | a8fe12e18fcdb50d9f6cf93d9a642e22f25c0184 (diff) |
Catch exceptions from BackupStoreDaemon::Run and log them without killing
the server process, on platforms where forking is disabled (Win32). (refs #3)
-rw-r--r-- | bin/bbstored/BackupStoreDaemon.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/bin/bbstored/BackupStoreDaemon.cpp b/bin/bbstored/BackupStoreDaemon.cpp index f4968a46..196cacfb 100644 --- a/bin/bbstored/BackupStoreDaemon.cpp +++ b/bin/bbstored/BackupStoreDaemon.cpp @@ -228,13 +228,38 @@ void BackupStoreDaemon::Run() else { // In server process -- use the base class to do the magic - ServerTLS<BOX_PORT_BBSTORED>::Run(); - + try + { + ServerTLS<BOX_PORT_BBSTORED>::Run(); + } + catch(BoxException &e) + { + ::syslog(LOG_ERR, "%s: disconnecting due to " + "exception %s (%d/%d)", DaemonName(), + e.what(), e.GetType(), e.GetSubType()); + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "%s: disconnecting due to " + "exception %s", DaemonName(), e.what()); + } + catch(...) + { + ::syslog(LOG_ERR, "%s: disconnecting due to " + "unknown exception", DaemonName()); + } + + if (!mInterProcessCommsSocket.IsOpened()) + { + return; + } + // Why did it stop? Tell the housekeeping process to do the same if(IsReloadConfigWanted()) { mInterProcessCommsSocket.Write("h\n", 2); } + if(IsTerminateWanted()) { mInterProcessCommsSocket.Write("t\n", 2); |