summaryrefslogtreecommitdiff
path: root/bin/bbackupd/BackupDaemon.h
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/BackupDaemon.h
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/BackupDaemon.h')
-rw-r--r--bin/bbackupd/BackupDaemon.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/bin/bbackupd/BackupDaemon.h b/bin/bbackupd/BackupDaemon.h
index 925aea1a..649f00cc 100644
--- a/bin/bbackupd/BackupDaemon.h
+++ b/bin/bbackupd/BackupDaemon.h
@@ -57,8 +57,8 @@ class Archive;
// Created: 2003/10/08
//
// --------------------------------------------------------------------------
-class BackupDaemon : public Daemon, ProgressNotifier, LocationResolver,
-RunStatusProvider, SysadminNotifier, BackgroundTask
+class BackupDaemon : public Daemon, public ProgressNotifier, public LocationResolver,
+public RunStatusProvider, public SysadminNotifier, public BackgroundTask
{
public:
BackupDaemon();
@@ -118,8 +118,8 @@ private:
public:
void InitCrypto();
- void RunSyncNowWithExceptionHandling();
- void RunSyncNow();
+ std::auto_ptr<BackupClientContext> RunSyncNowWithExceptionHandling();
+ std::auto_ptr<BackupClientContext> RunSyncNow();
void ResetCachedState();
void OnBackupStart();
void OnBackupFinish();
@@ -127,6 +127,21 @@ public:
// This does NOT constitute an API!
void TouchFileInWorkingDir(const char *Filename);
+protected:
+ virtual std::auto_ptr<BackupClientContext> GetNewContext
+ (
+ LocationResolver &rResolver,
+ TLSContext &rTLSContext,
+ const std::string &rHostname,
+ int32_t Port,
+ uint32_t AccountNumber,
+ bool ExtendedLogging,
+ bool ExtendedLogToFile,
+ std::string ExtendedLogFile,
+ ProgressNotifier &rProgressNotifier,
+ bool TcpNiceMode
+ );
+
private:
void DeleteAllLocations();
void SetupLocations(BackupClientContext &rClientContext, const Configuration &rLocationsConf);
@@ -244,6 +259,7 @@ private:
RunStatusProvider* mpRunStatusProvider;
SysadminNotifier* mpSysadminNotifier;
std::auto_ptr<Timer> mapCommandSocketPollTimer;
+ std::auto_ptr<BackupClientContext> mapClientContext;
/* ProgressNotifier implementation */
public: