Changeset 3048 for box/trunk


Ignore:
Timestamp:
12/12/2011 23:36:25 (5 months ago)
Author:
chris
Message:

Log the account name with connections, disconnections and statistics, requested by Pete Jalajas.

Location:
box/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • box/trunk

  • box/trunk/bin/bbstored/BackupStoreDaemon.cpp

    r2983 r3048  
    318318        { 
    319319                // Bad! Disconnect immediately 
     320                BOX_WARNING("Failed login: invalid client common name: " << 
     321                        clientCommonName); 
    320322                return; 
    321323        } 
     
    354356        catch(...) 
    355357        { 
    356                 LogConnectionStats(clientCommonName.c_str(), rStream); 
     358                LogConnectionStats(id, context.GetAccountName(), rStream); 
    357359                throw; 
    358360        } 
    359         LogConnectionStats(clientCommonName.c_str(), rStream); 
     361        LogConnectionStats(id, context.GetAccountName(), rStream); 
    360362        context.CleanUp(); 
    361363} 
    362364 
    363 void BackupStoreDaemon::LogConnectionStats(const char *commonName, 
    364                 const SocketStreamTLS &s) 
     365void BackupStoreDaemon::LogConnectionStats(uint32_t accountId, 
     366        const std::string& accountName, const SocketStreamTLS &s) 
    365367{ 
    366368        // Log the amount of data transferred 
    367         BOX_NOTICE("Connection statistics for " << commonName << ":" 
     369        BOX_NOTICE("Connection statistics for " <<  
     370                BOX_FORMAT_ACCOUNT(accountId) << " " 
     371                "(name=" << accountName << "):" 
    368372                " IN="  << s.GetBytesRead() << 
    369373                " OUT=" << s.GetBytesWritten() << 
  • box/trunk/bin/bbstored/BackupStoreDaemon.h

    r2541 r3048  
    6464        void HousekeepingProcess(); 
    6565 
    66         void LogConnectionStats(const char *commonName, const SocketStreamTLS &s); 
     66        void LogConnectionStats(uint32_t accountId, 
     67                const std::string& accountName, const SocketStreamTLS &s); 
    6768 
    6869public: 
  • box/trunk/lib/backupstore/BackupCommands.cpp

    r2983 r3048  
    9090        { 
    9191                BOX_WARNING("Failed login from client ID " <<  
    92                         BOX_FORMAT_ACCOUNT(mClientID) << 
    93                         ": wrong certificate for this account"); 
     92                        BOX_FORMAT_ACCOUNT(mClientID) << ": " 
     93                        "wrong certificate for this account"); 
    9494                return PROTOCOL_ERROR(Err_BadLogin); 
    9595        } 
     
    9898        { 
    9999                BOX_WARNING("Failed login from client ID " <<  
    100                         BOX_FORMAT_ACCOUNT(mClientID) << 
    101                         ": no such account on this server"); 
     100                        BOX_FORMAT_ACCOUNT(mClientID) << ": " 
     101                        "no such account on this server"); 
    102102                return PROTOCOL_ERROR(Err_BadLogin); 
    103103        } 
     
    129129        // Log login 
    130130        BOX_NOTICE("Login from Client ID " <<  
    131                 BOX_FORMAT_ACCOUNT(mClientID) << 
    132                 " " << 
     131                BOX_FORMAT_ACCOUNT(mClientID) << " " 
     132                "(name=" << rContext.GetAccountName() << "): " << 
    133133                (((mFlags & Flags_ReadOnly) != Flags_ReadOnly) 
    134134                ?"Read/Write":"Read-only")); 
     
    153153{ 
    154154        BOX_NOTICE("Session finished for Client ID " <<  
    155                 BOX_FORMAT_ACCOUNT(rContext.GetClientID())); 
     155                BOX_FORMAT_ACCOUNT(rContext.GetClientID()) << " " 
     156                "(name=" << rContext.GetAccountName() << ")"); 
    156157 
    157158        // Let the context know about it 
  • box/trunk/lib/backupstore/BackupStoreContext.h

    r2988 r3048  
    1616 
    1717#include "autogen_BackupProtocol.h" 
     18#include "BackupStoreInfo.h" 
    1819#include "BackupStoreRefCountDatabase.h" 
    1920#include "NamedLock.h" 
     
    2324class BackupStoreDirectory; 
    2425class BackupStoreFilename; 
    25 class BackupStoreInfo; 
    2626class IOStream; 
    2727class BackupProtocolMessage; 
     
    8181        void SaveStoreInfo(bool AllowDelay = true); 
    8282        const BackupStoreInfo &GetBackupStoreInfo() const; 
     83        const std::string GetAccountName() 
     84        { 
     85                if(!mapStoreInfo.get()) 
     86                { 
     87                        return "Unknown"; 
     88                } 
     89                return mapStoreInfo->GetAccountName(); 
     90        } 
    8391 
    8492        // Client marker 
Note: See TracChangeset for help on using the changeset viewer.