void CClientRobot::Run() { clock_t nTick = clock(); while ( 1 ) { m_pNetWork.ReciveMessage(); float fElasp = (float)(clock() - nTick ) / (float)CLOCKS_PER_SEC ; nTick = clock(); if ( m_pCurentScene) { m_pCurentScene->OnUpdate(fElasp); } processReconnect(fElasp); Sleep(2); if ( m_pLastScene ) { delete m_pLastScene ; m_pLastScene = NULL ; } } m_pNetWork.ShutDown(); }
void ClientController::onSocket_Close() { boost::shared_ptr<ClientController> SELF = sharedMyself(); ioService()->deferredCall(boost::bind(&ClientController::fire_onClosed, SELF)); processReconnect(); eventClosedConnection()->fireObservers(SELF, 0); }
void ClientController::onSocket_Error(int error, const char*strerror) { boost::shared_ptr<ClientController> SELF = sharedMyself(); ioService()->deferredCall(boost::bind(&ClientController::fire_onError, SELF, error, std::string(strerror))); processReconnect(); eventClosedConnection()->fireObservers(shared_from_this(), error); }