summaryrefslogtreecommitdiff
path: root/bin/bbstored
diff options
context:
space:
mode:
Diffstat (limited to 'bin/bbstored')
-rw-r--r--bin/bbstored/BackupStoreDaemon.cpp20
-rw-r--r--bin/bbstored/BackupStoreDaemon.h2
2 files changed, 21 insertions, 1 deletions
diff --git a/bin/bbstored/BackupStoreDaemon.cpp b/bin/bbstored/BackupStoreDaemon.cpp
index 0afdaa5d..2752893a 100644
--- a/bin/bbstored/BackupStoreDaemon.cpp
+++ b/bin/bbstored/BackupStoreDaemon.cpp
@@ -278,7 +278,25 @@ void BackupStoreDaemon::Connection(SocketStreamTLS &rStream)
BackupProtocolServer server(rStream);
server.SetLogToSysLog(mExtendedLogging);
server.SetTimeout(BACKUP_STORE_TIMEOUT);
- server.DoServer(context);
+ try
+ {
+ server.DoServer(context);
+ }
+ catch(...)
+ {
+ LogConnectionStats(clientCommonName.c_str(), rStream);
+ throw;
+ }
+ LogConnectionStats(clientCommonName.c_str(), rStream);
context.CleanUp();
}
+void BackupStoreDaemon::LogConnectionStats(const char *commonName,
+ const SocketStreamTLS &s)
+{
+ // Log the amount of data transferred
+ ::syslog(LOG_INFO, "Connection statistics for %s: "
+ "IN=%lld OUT=%lld TOTAL=%lld\n", commonName,
+ s.GetBytesRead(), s.GetBytesWritten(),
+ s.GetBytesRead() + s.GetBytesWritten());
+}
diff --git a/bin/bbstored/BackupStoreDaemon.h b/bin/bbstored/BackupStoreDaemon.h
index 6c4a45bc..2fbe486d 100644
--- a/bin/bbstored/BackupStoreDaemon.h
+++ b/bin/bbstored/BackupStoreDaemon.h
@@ -61,6 +61,8 @@ protected:
void HousekeepingProcess();
bool CheckForInterProcessMsg(int AccountNum = 0, int MaximumWaitTime = 0);
+ void LogConnectionStats(const char *commonName, const SocketStreamTLS &s);
+
private:
BackupStoreAccountDatabase *mpAccountDatabase;
BackupStoreAccounts *mpAccounts;