Changeset 2262

Show
Ignore:
Timestamp:
21/08/2008 12:18:39 (3 months ago)
Author:
chris
Message:

Run housekeeping synchronously on all platforms if daemon is run in
single process mode (-D), not just on Windows.

Add a housekeeping interface to allow Boxi to run housekeeping.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp

    r2127 r2262  
    156156void BackupStoreDaemon::OnIdle() 
    157157{ 
    158         #ifdef WIN32 
     158        if (!IsSingleProcess()) 
     159        { 
     160                return; 
     161        } 
     162 
    159163        if (!mHousekeepingInited) 
    160164        { 
     
    164168 
    165169        RunHousekeepingIfNeeded(); 
    166         #endif 
    167170} 
    168171 
  • box/trunk/bin/bbstored/BackupStoreContext.cpp

    r2226 r2262  
    5454// 
    5555// -------------------------------------------------------------------------- 
    56 BackupStoreContext::BackupStoreContext(int32_t ClientID, BackupStoreDaemon &rDaemon) 
     56BackupStoreContext::BackupStoreContext(int32_t ClientID, 
     57        HousekeepingInterface &rDaemon) 
    5758        : mClientID(ClientID), 
    5859          mrDaemon(rDaemon), 
  • box/trunk/bin/bbstored/BackupStoreContext.h

    r2226 r2262  
    2727class StreamableMemBlock; 
    2828 
     29class HousekeepingInterface 
     30{ 
     31        public: 
     32        virtual ~HousekeepingInterface() { } 
     33        virtual void SendMessageToHousekeepingProcess(const void *Msg, int MsgLen) = 0; 
     34}; 
     35 
    2936// -------------------------------------------------------------------------- 
    3037// 
     
    3845{ 
    3946public: 
    40         BackupStoreContext(int32_t ClientID, BackupStoreDaemon &rDaemon); 
     47        BackupStoreContext(int32_t ClientID, HousekeepingInterface &rDaemon); 
    4148        ~BackupStoreContext(); 
    4249private: 
     
    132139private: 
    133140        int32_t mClientID; 
    134         BackupStoreDaemon &mrDaemon; 
     141        HousekeepingInterface &mrDaemon; 
    135142        int mProtocolPhase; 
    136143        bool mClientHasAccount; 
  • box/trunk/bin/bbstored/BackupStoreDaemon.cpp

    r2226 r2262  
    173173        mExtendedLogging = config.GetKeyValueBool("ExtendedLogging"); 
    174174         
    175 #ifdef WIN32     
    176         // Housekeeping runs synchronously on Win32 
    177 #else 
    178         // Fork off housekeeping daemon -- must only do this the first time Run() is called 
    179         if(!mHaveForkedHousekeeping) 
     175        // Fork off housekeeping daemon -- must only do this the first 
     176        // time Run() is called.  Housekeeping runs synchronously on Win32 
     177        // because IsSingleProcess() is always true 
     178         
     179#ifndef WIN32 
     180        if(!IsSingleProcess() && !mHaveForkedHousekeeping) 
    180181        { 
    181182                // Open a socket pair for communication 
     
    207208                                BOX_INFO("Housekeeping process started"); 
    208209                                // Ignore term and hup 
    209                                 // Parent will handle these and alert the child via the socket, don't want to randomly die 
     210                                // Parent will handle these and alert the 
     211                                // child via the socket, don't want to 
     212                                // randomly die! 
    210213                                ::signal(SIGHUP, SIG_IGN); 
    211214                                ::signal(SIGTERM, SIG_IGN); 
  • box/trunk/bin/bbstored/BackupStoreDaemon.h

    r2226 r2262  
    2929// 
    3030// -------------------------------------------------------------------------- 
    31 class BackupStoreDaemon : public ServerTLS<BOX_PORT_BBSTORED> 
     31class BackupStoreDaemon : public ServerTLS<BOX_PORT_BBSTORED>, 
     32        HousekeepingInterface 
    3233{ 
    3334        friend class HousekeepStoreAccount;