summaryrefslogtreecommitdiff
path: root/bin/bbackupd/BackupClientContext.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-09-04 01:36:23 +0000
committerChris Wilson <chris+github@qwirx.com>2014-09-04 01:36:23 +0000
commitcdf951635090755796c1b3bb1a7d70811b7c6c80 (patch)
treeaf7e431b7cd1313c5f410e2ba6b20f11bb0a4921 /bin/bbackupd/BackupClientContext.cpp
parent5549d3f6f42a22d355b4d83402824b03106bd79a (diff)
Allow access to BackupDaemon's BackupClientContext for tests.
The std::auto_ptr is now returned unclosed. If the caller of RunSyncNow() does nothing with the return value, then it will be released, closing the connection. However the caller can save the std::auto_ptr locally and poke around in it if necessary. This interface is designed for tests only! Merged back changes from the test refactor branch to reduce diffs. Fix failure to record client store marker, after BackupClientContext refactor. This caused the daemon not to abort safely if the CSM changed under our feet, meaning that our cached data is invalid. Fix for earlier patch to allow tests to access the BackupClientContext after backup completes, because a new CSM wasn't generated in time for bbackupd to record it, because the connection wasn't closed yet.
Diffstat (limited to 'bin/bbackupd/BackupClientContext.cpp')
-rw-r--r--bin/bbackupd/BackupClientContext.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/bin/bbackupd/BackupClientContext.cpp b/bin/bbackupd/BackupClientContext.cpp
index 0c229f94..96f99806 100644
--- a/bin/bbackupd/BackupClientContext.cpp
+++ b/bin/bbackupd/BackupClientContext.cpp
@@ -212,6 +212,17 @@ BackupProtocolCallable &BackupClientContext::GetConnection()
"same account?");
}
}
+ else // mClientStoreMarker == ClientStoreMarker_NotKnown
+ {
+ // Yes, choose one, the current time will do
+ box_time_t marker = GetCurrentBoxTime();
+
+ // Set it on the store
+ mapConnection->QuerySetClientStoreMarker(marker);
+
+ // Record it so that it can be picked up later.
+ mClientStoreMarker = marker;
+ }
// Log success
BOX_INFO("Connection made, login successful");
@@ -250,19 +261,6 @@ void BackupClientContext::CloseAnyOpenConnection()
{
try
{
- // Need to set a client store marker?
- if(mClientStoreMarker == ClientStoreMarker_NotKnown)
- {
- // Yes, choose one, the current time will do
- box_time_t marker = GetCurrentBoxTime();
-
- // Set it on the store
- mapConnection->QuerySetClientStoreMarker(marker);
-
- // Record it so that it can be picked up later.
- mClientStoreMarker = marker;
- }
-
// Quit nicely
mapConnection->QueryFinished();
}