void CClientReConnectManager::Close()
{
	ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_ThreadWritrLock);
	OUR_DEBUG((LM_ERROR, "[CClientReConnectManager::Close]Begin.\n"));
	//如果有定时器,则删除定时器
	CancelConnectTask();

	//关闭所有已存在的链接
	for (mapReactorConnectInfo::iterator b = m_mapConnectInfo.begin(); b != m_mapConnectInfo.end(); b++)
	{
		CReactorClientInfo* pClientInfo = (CReactorClientInfo*)b->second;
		pClientInfo->Close();
		SAFE_DELETE(pClientInfo);
	}

	for (mapReactorUDPConnectInfo::iterator ub = m_mapReactorUDPConnectInfo.begin(); ub != m_mapReactorUDPConnectInfo.end(); ub++)
	{
		CReactorUDPClient* pClientInfo = (CReactorUDPClient*)ub->second;
		pClientInfo->Close();
		SAFE_DELETE(pClientInfo);
	}

	m_mapConnectInfo.clear();
	m_mapReactorUDPConnectInfo.clear();
	m_ActiveTimer.deactivate();
	OUR_DEBUG((LM_ERROR, "[CClientReConnectManager::Close]End.\n"));
}
bool CClientReConnectManager::Close(int nServerID, EM_s2s ems2s)
{
	//如果是因为服务器断开,则只删除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 not 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;
	}

	//关闭链接对象
	if (NULL != pClientInfo->GetConnectClient())
	{
		pClientInfo->GetConnectClient()->ClinetClose(ems2s);
	}

	if(S2S_NEED_CALLBACK == ems2s)
	{
		//SAFE_DELETE(pClientInfo);
		//从map里面删除当前存在的对象
		//m_mapConnectInfo.erase(f);
	}
	else
	{
		pClientInfo->Close();
		SAFE_DELETE(pClientInfo);
		//从map里面删除当前存在的对象
		m_mapConnectInfo.erase(f);
	}

	return true;
}