diff options
Diffstat (limited to 'bin/bbstored/BackupStoreDaemon.cpp')
-rw-r--r-- | bin/bbstored/BackupStoreDaemon.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bin/bbstored/BackupStoreDaemon.cpp b/bin/bbstored/BackupStoreDaemon.cpp index 4de0a078..70ca1d67 100644 --- a/bin/bbstored/BackupStoreDaemon.cpp +++ b/bin/bbstored/BackupStoreDaemon.cpp @@ -20,7 +20,7 @@ #include "BackupStoreContext.h" #include "BackupStoreDaemon.h" #include "BackupStoreConfigVerify.h" -#include "autogen_BackupProtocolServer.h" +#include "autogen_BackupProtocol.h" #include "RaidFileController.h" #include "BackupStoreAccountDatabase.h" #include "BackupStoreAccounts.h" @@ -317,6 +317,8 @@ void BackupStoreDaemon::Connection2(SocketStreamTLS &rStream) if(::sscanf(clientCommonName.c_str(), "BACKUP-%x", &id) != 1) { // Bad! Disconnect immediately + BOX_WARNING("Failed login: invalid client common name: " << + clientCommonName); return; } @@ -327,7 +329,7 @@ void BackupStoreDaemon::Connection2(SocketStreamTLS &rStream) Logging::Tagger tagWithClientID(tag.str()); // Create a context, using this ID - BackupStoreContext context(id, *this); + BackupStoreContext context(id, *this, GetConnectionDetails()); if (mpTestHook) { @@ -353,19 +355,22 @@ void BackupStoreDaemon::Connection2(SocketStreamTLS &rStream) } catch(...) { - LogConnectionStats(clientCommonName.c_str(), rStream); + LogConnectionStats(id, context.GetAccountName(), rStream); throw; } - LogConnectionStats(clientCommonName.c_str(), rStream); + LogConnectionStats(id, context.GetAccountName(), rStream); context.CleanUp(); } -void BackupStoreDaemon::LogConnectionStats(const char *commonName, - const SocketStreamTLS &s) +void BackupStoreDaemon::LogConnectionStats(uint32_t accountId, + const std::string& accountName, const SocketStreamTLS &s) { // Log the amount of data transferred - BOX_NOTICE("Connection statistics for " << commonName << ":" + BOX_NOTICE("Connection statistics for " << + BOX_FORMAT_ACCOUNT(accountId) << " " + "(name=" << accountName << "):" " IN=" << s.GetBytesRead() << " OUT=" << s.GetBytesWritten() << + " NET_IN=" << (s.GetBytesRead() - s.GetBytesWritten()) << " TOTAL=" << (s.GetBytesRead() + s.GetBytesWritten())); } |