Logo Search packages:      
Sourcecode: verlihub version File versions

int nDirectConnect::cServerDC::OnNewConn ( cAsyncConn nc  )  [protected, virtual]

return negative if conn should be removed

Reimplemented from nServer::cAsyncSocketServer.

Definition at line 563 of file cserverdc.cpp.

References nUtils::cTime::AsPeriod(), nDirectConnect::cConnDC::CloseNice(), DCPublicHS(), nDirectConnect::nTables::cDCConf::hub_security, nDirectConnect::nTables::cDCConf::hub_version_special, mStartTime, mSysLoad, nServer::cAsyncSocketServer::mTime, nServer::cAsyncSocketServer::mUseDNS, nDirectConnect::cConnDC::Send(), nDirectConnect::cConnDC::SetTimeOut(), and nDirectConnect::nTables::cDCConf::timeout_length.

{
      cConnDC *conn = (cConnDC *)nc;
      stringstream errmsg,os;
      if(!conn) return -1;
      string omsg;
      cTime runtime;
      runtime -= mStartTime;

      omsg="$Lock EXTENDEDPROTOCOL_" LOCK_VERSION " Pk=version" HUB_VERSION_STRING "|";
      os << "This Hub Is Running Version " << HUB_VERSION_STRING << mC.hub_version_special << " " << HUB_VERSION_CLASS << " of " HUB_VERSION_NAME <<  " [RunTime: " << runtime.AsPeriod() << "]." << " [Current User Count: " << mUserCountTot << " ].|";
      cDCProto::Create_Chat(omsg,mC.hub_security,os.str());
      conn->Send(omsg, false);

      os.str(mEmpty);

      if (mSysLoad >= eSL_CRITICAL)
      {
            os << "Sorry, hub is very busy, try later.";
            DCPublicHS(os.str(), conn);
            conn->CloseNice(500, eCR_HUB_LOAD);
            return -1;
      }

#ifndef _WIN32
      if(!this->mUseDNS) conn->SetTimeOut(eTO_KEY, mC.timeout_length[eTO_KEY], mTime);
#endif
      #ifndef WITHOUT_PLUGINS
      mCallBacks.mOnNewConn.CallAll(conn);
      #endif
      return 0;
}


Generated by  Doxygen 1.6.0   Back to index