From e00bd81ce959d02d3fa62e7e75956162f8e70c7e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 4 Sep 2014 01:36:19 +0000 Subject: 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. --- bin/bbackupd/BackupClientContext.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'bin/bbackupd/BackupClientContext.cpp') 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 { -- cgit v1.2.3