bool CClientReConnectManager::CloseByClient(int nServerID) { //如果是因为远程连接断开,则只删除ProConnectClient的指针 ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_ThreadWritrLock); mapReactorConnectInfo::iterator f = m_mapConnectInfo.find(nServerID); if (f == m_mapConnectInfo.end()) { //如果这个链接已经存在,则不创建新的链接 OUR_DEBUG((LM_ERROR, "[CClientReConnectManager::Close]nServerID =(%d) is exist.\n", nServerID)); return false; } CReactorClientInfo* pClientInfo = (CReactorClientInfo*)f->second; if (NULL == pClientInfo) { OUR_DEBUG((LM_ERROR, "[CClientReConnectManager::Close]nServerID =(%d) pClientInfo is NULL.\n", nServerID)); return false; } pClientInfo->SetConnectClient(NULL); pClientInfo->SetServerConnectState(SERVER_CONNECT_FAIL); return true; }
bool CClientReConnectManager::CloseByClient(int nServerID) { //如果是因为远程连接断开,则只删除ProConnectClient的指针 ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_ThreadWritrLock); char szServerID[10] = {'\0'}; sprintf_safe(szServerID, 10, "%d", nServerID); CReactorClientInfo* pClientInfo = m_objClientTCPList.Get_Hash_Box_Data(szServerID); if (NULL != pClientInfo) { pClientInfo->SetConnectClient(NULL); pClientInfo->SetServerConnectState(SERVER_CONNECT_FAIL); } return true; }
bool CClientReConnectManager::SetServerConnectState(int nServerID, EM_Server_Connect_State objState) { ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_ThreadWritrLock); mapReactorConnectInfo::iterator f = m_mapConnectInfo.find(nServerID); if (f == m_mapConnectInfo.end()) { //如果这个链接已经存在,则不创建新的链接 OUR_DEBUG((LM_ERROR, "[CClientReConnectManager::Close]nServerID =(%d) is exist.\n", nServerID)); return false; } else { CReactorClientInfo* pClientInfo = (CReactorClientInfo*)f->second; pClientInfo->SetServerConnectState(objState); return true; } }
bool CClientReConnectManager::SetServerConnectState(int nServerID, EM_Server_Connect_State objState) { ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_ThreadWritrLock); char szServerID[10] = {'\0'}; sprintf_safe(szServerID, 10, "%d", nServerID); CReactorClientInfo* pClientInfo = m_objClientTCPList.Get_Hash_Box_Data(szServerID); if (NULL == pClientInfo) { //如果这个链接不存在,则不创建新的链接 OUR_DEBUG((LM_ERROR, "[CClientReConnectManager::Close]nServerID =(%d) is not exist.\n", nServerID)); return false; } else { pClientInfo->SetServerConnectState(objState); return true; } }