[Box Backup-commit] COMMIT r1096 - box/chris/merge/bin/bbstored
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Wed, 18 Oct 2006 20:50:07 +0100
Author: chris
Date: 2006-10-18 20:50:07 +0100 (Wed, 18 Oct 2006)
New Revision: 1096
Modified:
box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp
Log:
Catch exceptions from BackupStoreDaemon::Run and log them without killing
the server process, on platforms where forking is disabled (Win32). (refs #3)
Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-10-18 19:48:50 UTC (rev 1095)
+++ box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-10-18 19:50:07 UTC (rev 1096)
@@ -228,13 +228,38 @@
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);