[Box Backup-dev] COMMIT r803 - box/chris/merge/bin/bbackupd
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Sun Aug 20 11:06:55 BST 2006
Author: chris
Date: 2006-08-20 11:06:55 +0100 (Sun, 20 Aug 2006)
New Revision: 803
Modified:
box/chris/merge/bin/bbackupd/BackupDaemon.cpp
Log:
* bin/bbackupd/BackupDaemon.cpp
- Cleaned up SyncAllowScript cleanup code
- Fixed catching std::exception while handling command socket to do the
same as catching (...)
Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 09:56:28 UTC (rev 802)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 10:06:55 UTC (rev 803)
@@ -932,34 +932,26 @@
}
}
- // Wait and then cleanup child process
- int status = 0;
- ::waitpid(pid, &status, 0);
}
catch(std::exception &e)
{
::syslog(LOG_ERR, "Internal error running SyncAllowScript: "
"%s", e.what());
- // Clean up
- if(pid != 0)
- {
- int status = 0;
- ::waitpid(pid, &status, 0);
- }
}
catch(...)
{
// Ignore any exceptions
// Log that something bad happened
::syslog(LOG_ERR, "Error running SyncAllowScript '%s'", conf.GetKeyValue("SyncAllowScript").c_str());
- // Clean up though
- if(pid != 0)
- {
- int status = 0;
- ::waitpid(pid, &status, 0);
- }
}
+ // Wait and then cleanup child process, if any
+ if (pid != 0)
+ {
+ int status = 0;
+ ::waitpid(pid, &status, 0);
+ }
+
return waitInSeconds;
}
@@ -1157,7 +1149,17 @@
{
::syslog(LOG_ERR, "Internal error in command socket thread: "
"%s", e.what());
- throw; // thread will die
+ // If an error occurs, and there is a connection active, just close that
+ // connection and continue. Otherwise, let the error propagate.
+ if(mpCommandSocketInfo->mpConnectedSocket.get() == 0)
+ {
+ throw; // thread will die
+ }
+ else
+ {
+ // Close socket and ignore error
+ CloseCommandConnection();
+ }
}
catch(...)
{
More information about the Boxbackup-dev
mailing list