BOOL P2PManager::RunP2P(char* szIP, unsigned short Port) { GetPuCfgInstance().Init(); GetPuLogInstance().Init(); SetIdleTime(1000); SetSessionTimeout(8);//5 GetPuCfgInstance().SetSerial( 0 ); // if (THREADSTATUS_ZOMBIE == GetThreadStatus()) { SetReceivePktQueue(FALSE); SetBindInfo("0.0.0.0", 0, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF); SetRelayInfo( szIP, Port ); if (TRUE == CPuPeers::Start()) { GetSelfLocalInfo(m_sinLocal); SendCheckExternalIp(); SendCheckExternalIp(); } } return TRUE; }
bool ApnsService::Start() { auto iter = resolver_addr(false); if (iter == boost::asio::ip::tcp::resolver::iterator()) { LOGFMTE("resolver apns host faild"); return false; } if (!init_ssl_ctx()) { return false; } for (size_t i = 0; i < apns_params_.ApnsConnCount; i++) { auto conn = std::make_shared<ApnsConnection>(*io_service_, *ssl_ctx_, iter, this); conn->SetIdleTime(apns_params_.IdleTime); conn->Connect(); apns_conns_.push_back(conn); } //feed back service auto iter_feedback = resolver_addr(true); if (iter_feedback == boost::asio::ip::tcp::resolver::iterator()) { LOGFMTE("resolver apns feedback host faild"); return false; } fd_conn_.reset(new ApnsFeedBackConnection(*io_service_, *ssl_ctx_, iter_feedback, this)); //get feedback time interval int t = 24 * 3600; if (apns_params_.FeedBackTime > 0 && apns_params_.FeedBackTime < (30 * t)) { t = apns_params_.FeedBackTime; } SetTimer(1, 1000 * t, NULL); LOGFMTD("ApnsService %s start!", apns_params_.Name.c_str()); stopped_ = false; return true; }
void CVehicle::SpawnAt ( const CVector& vecPosition, const CVector& vecRotation ) { SetHealth ( GetRespawnHealth () ); SetBlowTime ( 0 ); SetIdleTime ( 0 ); GetInitialDoorStates ( m_ucDoorStates ); memset ( m_ucWheelStates, 0, sizeof ( m_ucWheelStates ) ); memset ( m_ucPanelStates, 0, sizeof ( m_ucPanelStates ) ); memset ( m_ucLightStates, 0, sizeof ( m_ucLightStates ) ); SetLandingGearDown ( true ); SetAdjustableProperty ( 0 ); CVector vecNull; m_vecTurnSpeed = vecNull; m_vecVelocity = vecNull; m_vecPosition = vecPosition; m_vecRotationDegrees = vecRotation; UpdateSpatialData (); }