[Box Backup-dev] COMMIT r859 - box/chris/merge/bin/bbackupd

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Aug 31 09:49:52 BST 2006


Author: chris
Date: 2006-08-31 09:49:52 +0100 (Thu, 31 Aug 2006)
New Revision: 859

Modified:
   box/chris/merge/bin/bbackupd/BackupDaemon.cpp
Log:
* bin/bbackupd/BackupDaemon.cpp
- Revert to trunk


Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2006-08-31 08:43:42 UTC (rev 858)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2006-08-31 08:49:52 UTC (rev 859)
@@ -262,7 +262,6 @@
 #ifdef WIN32
 void BackupDaemon::RunHelperThread(void)
 {
-	this->mReceivedCommandConn = false;
 	mpCommandSocketInfo = new CommandSocketInfo;
 	WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket);
 
@@ -274,6 +273,21 @@
 		{
 			rSocket.Accept(BOX_NAMED_PIPE_NAME);
 		}
+		catch (BoxException &e)
+		{
+			::syslog(LOG_ERR, "Failed to open command socket: %s",
+				e.what());
+			SetTerminateWanted();
+			break; // this is fatal to listening thread
+		}
+		catch (...)
+		{
+			::syslog(LOG_ERR, "Failed to open command socket: "
+				"unknown error");
+			SetTerminateWanted();
+			break; // this is fatal to listening thread
+		}
+		}
 		catch(std::exception &e)
 		{
 			::syslog(LOG_ERR, "Failed to open command socket: "
@@ -458,7 +472,7 @@
 			}
 			catch(std::exception &e)
 			{
-				::syslog(LOG_WARNING, "Internal error while "
+				::syslog(LOG_ERR, "Internal error while "
 					"closing command socket after "
 					"another exception: %s", e.what());
 			}
@@ -925,26 +939,34 @@
 			}
 		}
 		
+		// 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;
 }
 
@@ -1142,17 +1164,7 @@
 	{
 		::syslog(LOG_ERR, "Internal error in command socket thread: "
 			"%s", e.what());
-		// 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();
-		}
+		throw; // thread will die
 	}
 	catch(...)
 	{
@@ -2333,16 +2345,10 @@
 		::syslog(LOG_INFO, "Saved store object info file '%s'", 
 			StoreObjectInfoFile.c_str());
 	}
-	catch(std::exception &e)
-	{
-		::syslog(LOG_ERR, "Internal error writing store object "
-			"info file (%s): %s",
-			StoreObjectInfoFile.c_str(), e.what());
-	}
 	catch(...)
 	{
-		::syslog(LOG_ERR, "Internal error writing store object "
-			"info file (%s): unknown error",
+		::syslog(LOG_WARNING, "Requested store object info file '%s' "
+			"not accessible or could not be created", 
 			StoreObjectInfoFile.c_str());
 	}
 
@@ -2498,14 +2504,12 @@
 	catch(std::exception &e)
 	{
 		::syslog(LOG_ERR, "Internal error reading store object "
-			"info file (%s): %s",
-			StoreObjectInfoFile.c_str(), e.what());
+			"info file: %s", e.what());
 	}
 	catch(...)
 	{
 		::syslog(LOG_ERR, "Internal error reading store object "
-			"info file (%s): unknown error",
-			StoreObjectInfoFile.c_str());
+			"info file: unknown error");
 	}
 
 	DeleteAllLocations();




More information about the Boxbackup-dev mailing list