diff options
Diffstat (limited to 'bin/bbackupd')
-rw-r--r-- | bin/bbackupd/BackupClientContext.cpp | 16 | ||||
-rw-r--r-- | bin/bbackupd/BackupClientContext.h | 4 | ||||
-rw-r--r-- | bin/bbackupd/BackupClientDeleteList.cpp | 2 | ||||
-rw-r--r-- | bin/bbackupd/BackupClientDirectoryRecord.cpp | 14 |
4 files changed, 20 insertions, 16 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 { diff --git a/bin/bbackupd/BackupClientContext.h b/bin/bbackupd/BackupClientContext.h index a1b5d824..04af1645 100644 --- a/bin/bbackupd/BackupClientContext.h +++ b/bin/bbackupd/BackupClientContext.h @@ -58,7 +58,7 @@ private: BackupClientContext(const BackupClientContext &); public: - BackupProtocolClient &GetConnection(); + virtual BackupProtocolCallable &GetConnection(); void CloseAnyOpenConnection(); int GetTimeout() const; BackupClientDeleteList &GetDeleteList(); @@ -223,7 +223,7 @@ private: std::string mHostname; int mPort; uint32_t mAccountNumber; - std::auto_ptr<BackupProtocolClient> mapConnection; + std::auto_ptr<BackupProtocolCallable> mapConnection; bool mExtendedLogging; bool mExtendedLogToFile; std::string mExtendedLogFile; diff --git a/bin/bbackupd/BackupClientDeleteList.cpp b/bin/bbackupd/BackupClientDeleteList.cpp index c0414b78..ce5e6264 100644 --- a/bin/bbackupd/BackupClientDeleteList.cpp +++ b/bin/bbackupd/BackupClientDeleteList.cpp @@ -132,7 +132,7 @@ void BackupClientDeleteList::PerformDeletions(BackupClientContext &rContext) } // Get a connection - BackupProtocolClient &connection(rContext.GetConnection()); + BackupProtocolCallable &connection(rContext.GetConnection()); // Do the deletes for(std::vector<DirToDelete>::iterator i(mDirectoryList.begin()); diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index 292330ab..58cf0ebb 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -711,7 +711,7 @@ void BackupClientDirectoryRecord::UpdateAttributes(BackupClientDirectoryRecord:: if(updateAttr) { // Get connection to store - BackupProtocolClient &connection(rParams.mrContext.GetConnection()); + BackupProtocolCallable &connection(rParams.mrContext.GetConnection()); // Exception thrown if this doesn't work std::auto_ptr<IOStream> attrStream(new MemBlockStream(attr)); @@ -898,7 +898,7 @@ bool BackupClientDirectoryRecord::UpdateItems( // Therefore we can safely rename it to this new file. // Get the connection to the server - BackupProtocolClient &connection(rContext.GetConnection()); + BackupProtocolCallable &connection(rContext.GetConnection()); // Only do this step if there is room on the server. // This step will be repeated later when there is space available @@ -1169,7 +1169,7 @@ bool BackupClientDirectoryRecord::UpdateItems( // been downloaded, and the entry will be available. // Get connection - BackupProtocolClient &connection(rContext.GetConnection()); + BackupProtocolCallable &connection(rContext.GetConnection()); // Only do this step if there is room on the server. // This step will be repeated later when there is @@ -1327,7 +1327,7 @@ bool BackupClientDirectoryRecord::UpdateItems( { // Entry exists, but is not a directory. Bad. // Get rid of it. - BackupProtocolClient &connection(rContext.GetConnection()); + BackupProtocolCallable &connection(rContext.GetConnection()); connection.QueryDeleteFile(mObjectID /* in directory */, storeFilename); std::string filenameClear = DecryptFilename(en, @@ -1577,7 +1577,7 @@ int64_t BackupClientDirectoryRecord::CreateRemoteDir(const std::string& localDir } // Get connection - BackupProtocolClient &connection(rParams.mrContext.GetConnection()); + BackupProtocolCallable &connection(rParams.mrContext.GetConnection()); // Don't do a check for storage limit exceeded here, because if we get to this // stage, a connection will have been opened, and the status known, so the check @@ -1668,7 +1668,7 @@ void BackupClientDirectoryRecord::RemoveDirectoryInPlaceOfFile( const std::string &rFilename) { // First, delete the directory - BackupProtocolClient &connection(rParams.mrContext.GetConnection()); + BackupProtocolCallable &connection(rParams.mrContext.GetConnection()); connection.QueryDeleteDirectory(pEntry->GetObjectID()); BackupStoreFilenameClear clear(pEntry->GetName()); @@ -1720,7 +1720,7 @@ int64_t BackupClientDirectoryRecord::UploadFile( ProgressNotifier& rNotifier(rContext.GetProgressNotifier()); // Get the connection - BackupProtocolClient &connection(rContext.GetConnection()); + BackupProtocolCallable &connection(rContext.GetConnection()); // Info int64_t objID = 0; |