[Box Backup-commit] COMMIT r1178 - box/chris/merge/bin/bbstored
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Sun Nov 26 19:47:49 GMT 2006
Author: chris
Date: 2006-11-26 19:47:49 +0000 (Sun, 26 Nov 2006)
New Revision: 1178
Modified:
box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp
box/chris/merge/bin/bbstored/BackupStoreDaemon.h
Log:
Catch any exceptions while handling a connection and report to user
rather than terminating. Useful for non-forking servers like bbstored on
Windows. (refs #3)
Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-11-26 19:45:44 UTC (rev 1177)
+++ box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-11-26 19:47:49 UTC (rev 1178)
@@ -247,17 +247,49 @@
}
}
-
// --------------------------------------------------------------------------
//
// Function
// Name: BackupStoreDaemon::Connection(SocketStreamTLS &)
-// Purpose: Handles a connection
+// Purpose: Handles a connection, by catching exceptions and
+// delegating to Connection2
// Created: 2003/08/20
//
// --------------------------------------------------------------------------
void BackupStoreDaemon::Connection(SocketStreamTLS &rStream)
{
+ try
+ {
+ Connection2(rStream);
+ }
+ 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());
+ }
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+// Name: BackupStoreDaemon::Connection2(SocketStreamTLS &)
+// Purpose: Handles a connection from bbackupd
+// Created: 2006/11/12
+//
+// --------------------------------------------------------------------------
+void BackupStoreDaemon::Connection2(SocketStreamTLS &rStream)
+{
// Get the common name from the certificate
std::string clientCommonName(rStream.GetPeerCommonName());
Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h
===================================================================
--- box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-11-26 19:45:44 UTC (rev 1177)
+++ box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-11-26 19:47:49 UTC (rev 1178)
@@ -52,7 +52,8 @@
virtual void Run();
- void Connection(SocketStreamTLS &rStream);
+ virtual void Connection(SocketStreamTLS &rStream);
+ void Connection2(SocketStreamTLS &rStream);
virtual const char *DaemonName() const;
virtual const char *DaemonBanner() const;
More information about the Boxbackup-commit
mailing list