diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-09-04 01:36:19 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-09-04 01:36:19 +0000 |
commit | e00bd81ce959d02d3fa62e7e75956162f8e70c7e (patch) | |
tree | df37302243b921f7adc26908ee1c9c5ea00afa60 /bin/bbackupd/BackupClientContext.cpp | |
parent | 944745c21c7df19ada39e1d347ca732c1f424070 (diff) |
Changed many uses of BackupProtocolClient to BackupProtocolCallable.
Makes way for more use of local protocol objects and protocol subclasses.
Merged back changes from the test refactor branch to reduce diffs.
Diffstat (limited to 'bin/bbackupd/BackupClientContext.cpp')
-rw-r--r-- | bin/bbackupd/BackupClientContext.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/bbackupd/BackupClientContext.cpp b/bin/bbackupd/BackupClientContext.cpp index 977f7ec1..0c229f94 100644 --- a/bin/bbackupd/BackupClientContext.cpp +++ b/bin/bbackupd/BackupClientContext.cpp @@ -107,7 +107,7 @@ BackupClientContext::~BackupClientContext() // Created: 2003/10/08 // // -------------------------------------------------------------------------- -BackupProtocolClient &BackupClientContext::GetConnection() +BackupProtocolCallable &BackupClientContext::GetConnection() { // Already got it? Just return it. if(mapConnection.get()) @@ -144,10 +144,14 @@ BackupProtocolClient &BackupClientContext::GetConnection() apSocket.reset(mpNice); } - mapConnection.reset(new BackupProtocolClient(apSocket)); + // We need to call some methods that aren't defined in + // BackupProtocolCallable, so we need to hang onto a more + // strongly typed pointer (to avoid far too many casts). + BackupProtocolClient *pClient = new BackupProtocolClient(apSocket); + mapConnection.reset(pClient); // Set logging option - mapConnection->SetLogToSysLog(mExtendedLogging); + pClient->SetLogToSysLog(mExtendedLogging); if (mExtendedLogToFile) { @@ -163,12 +167,12 @@ BackupProtocolClient &BackupClientContext::GetConnection() } else { - mapConnection->SetLogToFile(mpExtendedLogFileHandle); + pClient->SetLogToFile(mpExtendedLogFileHandle); } } // Handshake - mapConnection->Handshake(); + pClient->Handshake(); // Check the version of the server { @@ -405,7 +409,7 @@ bool BackupClientContext::FindFilename(int64_t ObjectID, int64_t ContainingDirec bool &rIsCurrentVersionOut, box_time_t *pModTimeOnServer, box_time_t *pAttributesHashOnServer, BackupStoreFilenameClear *pLeafname) { // Make a connection to the server - BackupProtocolClient &connection(GetConnection()); + BackupProtocolCallable &connection(GetConnection()); // Request filenames from the server, in a "safe" manner to ignore errors properly { |