コード例 #1
0
ファイル: RegistrarPersist.cpp プロジェクト: LordGaav/sipxecs
/// Garbage-collection and persist the registration DB
void RegistrarPersist::cleanAndPersist()
{
   // Change state to indicate that the timer is no longer running.
   // Do this *before* saving the DB so that any DB changes that happen just after
   // we write the changes to disk will cause the timer to restart.
   {
      OsLock mutex(mLock);
      mIsTimerRunning = false;
   }

   // Save the DB
   getRegistrarServer().cleanAndPersist();
}
コード例 #2
0
ファイル: SipRegistrar.cpp プロジェクト: mranga/sipxecs
/// Launch all Startup Phase threads.
void SipRegistrar::startupPhase()
{
   OsSysLog::add(FAC_SIP, PRI_INFO, "SipRegistrar entering startup phase");

   // Create and start the persist thread, before making any changes
   // to the registration DB.
   createAndStartPersist();

   if (mReplicationConfigured)
   {
      // Create replication-related thread objects, because they own some
      // the data that the RegistrarInitialSync thread needs,
      // but don't start them yet.
      createReplicationThreads();

      // Begin the RegistrarInitialSync thread and then wait for it.
      // The RegistrarInitialSync thread performs steps (1) to (4) of
      // section 5.7.1 of sipXregistry/doc/SyncDesign.*.
      OsSysLog::add(FAC_SIP, PRI_DEBUG,
                    "SipRegistrar::startupPhase starting initialSyncThread"
                    );
      mRegistrarInitialSync->start();
      yield();
      mRegistrarInitialSync->waitForCompletion();

      // The initial sync thread has no further value, to the ash heap of history it goes
      delete mRegistrarInitialSync;
      mRegistrarInitialSync = NULL;
   }
   else
   {
      OsSysLog::add(FAC_SIP, PRI_INFO,
                    "SipRegistrar::startupPhase no replication configured"
                    );
   }

   // Reset the DbUpdateNumber so that the upper half is the epoch time.
   // Step (5) in section 5.7.1 of sipXregistry/doc/SyncDesign.*.
   // We perform this even if there are no peer registrars to ensure that
   // update numbers are monotonic even if HA is enabled and then disabled.
   getRegistrarServer().resetDbUpdateNumberEpoch();

   // Step (6) is not performed explicitly.  Instead, we allow the normal
   // operation of the RegistrarTest thread to do that processing.
}