summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-11-13 19:52:05 +0000
committerChris Wilson <chris+github@qwirx.com>2006-11-13 19:52:05 +0000
commit7e22c206a755fa481da252e8286251fea4d5b1ce (patch)
tree572ebac05b3af4ad634c2dd9df3442166ae54849 /bin
parent9323f23b4f2148b2bf7c31f0b67cf2ca447eac66 (diff)
Revert [1096] as it causes infinite loops if the listening socket
can't be opened (refs #3)
Diffstat (limited to 'bin')
-rw-r--r--bin/bbstored/BackupStoreDaemon.cpp65
1 files changed, 36 insertions, 29 deletions
diff --git a/bin/bbstored/BackupStoreDaemon.cpp b/bin/bbstored/BackupStoreDaemon.cpp
index e09bd17d..ca28ed57 100644
--- a/bin/bbstored/BackupStoreDaemon.cpp
+++ b/bin/bbstored/BackupStoreDaemon.cpp
@@ -227,38 +227,13 @@ void BackupStoreDaemon::Run()
else
{
// In server process -- use the base class to do the magic
- 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;
- }
-
+ ServerTLS<BOX_PORT_BBSTORED>::Run();
+
// 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);
@@ -266,17 +241,49 @@ void BackupStoreDaemon::Run()
}
}
-
// --------------------------------------------------------------------------
//
// 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());