diff options
Diffstat (limited to 'bin/bbackupd/BackupClientContext.cpp')
-rw-r--r-- | bin/bbackupd/BackupClientContext.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/bin/bbackupd/BackupClientContext.cpp b/bin/bbackupd/BackupClientContext.cpp index 4b4efd90..b978f54c 100644 --- a/bin/bbackupd/BackupClientContext.cpp +++ b/bin/bbackupd/BackupClientContext.cpp @@ -41,17 +41,20 @@ // -------------------------------------------------------------------------- BackupClientContext::BackupClientContext ( - BackupDaemon &rDaemon, + LocationResolver &rResolver, TLSContext &rTLSContext, const std::string &rHostname, + int Port, int32_t AccountNumber, bool ExtendedLogging, bool ExtendedLogToFile, - std::string ExtendedLogFile + std::string ExtendedLogFile, + ProgressNotifier& rProgressNotifier ) - : mrDaemon(rDaemon), + : mrResolver(rResolver), mrTLSContext(rTLSContext), mHostname(rHostname), + mPort(Port), mAccountNumber(AccountNumber), mpSocket(0), mpConnection(0), @@ -66,8 +69,9 @@ BackupClientContext::BackupClientContext mStorageLimitExceeded(false), mpExcludeFiles(0), mpExcludeDirs(0), - mKeepAliveTimer(0), - mbIsManaged(false) + mKeepAliveTimer(0, "KeepAliveTime"), + mbIsManaged(false), + mrProgressNotifier(rProgressNotifier) { } @@ -129,7 +133,8 @@ BackupProtocolClient &BackupClientContext::GetConnection() mHostname << "'..."); // Connect! - mpSocket->Open(mrTLSContext, Socket::TypeINET, mHostname.c_str(), BOX_PORT_BBSTORED); + mpSocket->Open(mrTLSContext, Socket::TypeINET, + mHostname.c_str(), mPort); // And create a procotol object mpConnection = new BackupProtocolClient(*mpSocket); @@ -146,8 +151,8 @@ BackupProtocolClient &BackupClientContext::GetConnection() if (!mpExtendedLogFileHandle) { - BOX_ERROR("Failed to open extended log " - "file: " << strerror(errno)); + BOX_LOG_SYS_ERROR("Failed to open extended " + "log file: " << mExtendedLogFile); } else { @@ -465,7 +470,7 @@ bool BackupClientContext::FindFilename(int64_t ObjectID, int64_t ContainingDirec { // Location name -- look up in daemon's records std::string locPath; - if(!mrDaemon.FindLocationPathName(elementName.GetClearFilename(), locPath)) + if(!mrResolver.FindLocationPathName(elementName.GetClearFilename(), locPath)) { // Didn't find the location... so can't give the local filename return false; @@ -504,7 +509,7 @@ void BackupClientContext::SetKeepAliveTime(int iSeconds) { mKeepAliveTime = iSeconds < 0 ? 0 : iSeconds; BOX_TRACE("Set keep-alive time to " << mKeepAliveTime << " seconds"); - mKeepAliveTimer = Timer(mKeepAliveTime); + mKeepAliveTimer = Timer(mKeepAliveTime, "KeepAliveTime"); } // -------------------------------------------------------------------------- @@ -564,7 +569,7 @@ void BackupClientContext::DoKeepAlive() BOX_TRACE("KeepAliveTime reached, sending keep-alive message"); mpConnection->QueryGetIsAlive(); - mKeepAliveTimer = Timer(mKeepAliveTime); + mKeepAliveTimer = Timer(mKeepAliveTime, "KeepAliveTime"); } int BackupClientContext::GetMaximumDiffingTime() |