Logo Search packages:      
Sourcecode: verlihub version File versions

int nDirectConnect::cServerDC::OnTimer ( cTime now  )  [virtual]

this is called every period of time

Reimplemented from nServer::cAsyncSocketServer.

Definition at line 1060 of file cserverdc.cpp.

References nUtils::tHashArray< DataType >::AutoResize(), nUtils::cTimeOut::Check(), nDirectConnect::cUserCollection::FlushCache(), nDirectConnect::nTables::cDCConf::hublist_host, nDirectConnect::nTables::cDCConf::hublist_port, nDirectConnect::nTables::cDCConf::Load(), cObj::Log(), cObj::LogStream(), nDirectConnect::nTables::cDCConf::max_upload_kbps, mBanList, nDirectConnect::nTables::cDCConf::min_frequency, nUtils::cTimeOut::mMinDelay, mOpList, mSysLoad, nDirectConnect::nTables::cBanList::mTempIPBanlist, nDirectConnect::nTables::cBanList::mTempNickBanlist, nServer::cAsyncSocketServer::mTime, mTmpFunc, nDirectConnect::cDCConsole::mTriggers, RegisterInHublist(), nConfig::tMySQLMemoryList< DataType, OwnerType >::ReloadAll(), nDirectConnect::nTables::cBanList::RemoveOldShortTempBans(), nUtils::cTime::Sec(), nDirectConnect::nTables::cRegList::UpdateCache(), and nDirectConnect::nTables::cDCConf::use_reglist_cache.

{
      mHelloUsers.FlushCache();
      mUserList.FlushCache();
      mOpList.FlushCache();
      mOpchatList.FlushCache();
      mActiveUsers.FlushCache();
      mChatUsers.FlushCache();
      mInProgresUsers.FlushCache();
      
      mSysLoad = eSL_COOL;
      if ( mFrequency.mNumFill > 0 ) 
      {
            double freq = mFrequency.GetMean(mTime);
            if(freq < 1.2 * mC.min_frequency) mSysLoad = eSL_HURRY;
            if(freq < 1.0 * mC.min_frequency) mSysLoad = eSL_SQEEZY;
            if(freq < 0.8 * mC.min_frequency) mSysLoad = eSL_CRITICAL;
            if(freq < 0.5 * mC.min_frequency) mSysLoad = eSL_SYSTEM_DOWN;
      }     

      if ( mC.max_upload_kbps > 0.00001) 
      {
            int zone;
            double total_upload=0.;
            for ( zone = 0; zone <= USER_ZONES; zone ++ )
                  total_upload += this->mUploadZone[zone].GetMean(this->mTime);
            if ((total_upload / 1024.0) > mC.max_upload_kbps)
            {
                  mSysLoad = eSL_SQEEZY;
            }
      }

      // perform all temp functions
      for (tTFIt i = mTmpFunc.begin(); i != mTmpFunc.end(); i++)
      {
            if (*i) {
                  // delete finished functions
                  if((*i)->done()) {
                        delete *i;
                        (*i) = NULL;
//                      cout << " deleting tmpfunc" << endl;
                  } else {
                        // step the rest
                        (*i)->step();
                  }
            }
      }

      if (bool(mSlowTimer.mMinDelay) && mSlowTimer.Check(mTime , 1) == 0)
            mBanList->RemoveOldShortTempBans(mTime.Sec());
      if (bool(mHublistTimer.mMinDelay) && mHublistTimer.Check(mTime , 1) == 0)
            this->RegisterInHublist(mC.hublist_host, mC.hublist_port, NULL);
      if (bool(mReloadcfgTimer.mMinDelay) && mReloadcfgTimer.Check(mTime , 1) == 0)
      {
            mC.Load();
            mCo->mTriggers->ReloadAll();
            if (mC.use_reglist_cache) mR->UpdateCache();
            if (Log(2)) LogStream() << "Socket counter : " << cAsyncConn::sSocketCounter << endl;
      }

      mUserList.AutoResize();
      mHelloUsers.AutoResize();
      mActiveUsers.AutoResize();
      mChatUsers.AutoResize();
      mOpList.AutoResize();
      mOpchatList.AutoResize();
      mInProgresUsers.AutoResize();

      mBanList->mTempNickBanlist.AutoResize();
      mBanList->mTempIPBanlist.AutoResize();

      #ifndef WITHOUT_PLUGINS
      if (!mCallBacks.mOnTimer.CallAll())
            return false;
      #endif
      return true;
}


Generated by  Doxygen 1.6.0   Back to index