diff options
author | Ben Summers <ben@fluffy.co.uk> | 2006-02-13 13:35:51 +0000 |
---|---|---|
committer | Ben Summers <ben@fluffy.co.uk> | 2006-02-13 13:35:51 +0000 |
commit | ab0b336a656d168d132f685ead24c0c18df4a612 (patch) | |
tree | 4bfa00b9e5c35200c5439bcdf8ca754107e11c62 /bin/bbstored/BackupStoreDaemon.cpp | |
parent | 830aa82e44381c85d8486e46de7ae0e26830457e (diff) |
Bandwidth usage logging patch from Pascal Lalonde <plalonde@overnet.qc.ca>, with minor change to exception handling
Diffstat (limited to 'bin/bbstored/BackupStoreDaemon.cpp')
-rw-r--r-- | bin/bbstored/BackupStoreDaemon.cpp | 20 |
1 files changed, 19 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()); +} |