/** ** \brief 向容器中添加已经成功的连接 ** \param sceneClient 待添加的连接 **/ void SceneClientManager::add(SceneClient *sceneClient) { if (sceneClient) { zRWLock_scope_wrlock scope_wrlock(rwlock); allClients.insert(value_type(sceneClient->getServerID(),sceneClient)); } }
/** ** \brief 从容器中移除断开的连接 ** \param sceneClient 待移除的连接 **/ void SceneClientManager::remove(SceneClient *sceneClient) { if (sceneClient) { zRWLock_scope_wrlock scope_wrlock(rwlock); iter it = allClients.find(sceneClient->getServerID()); if (it != allClients.end()) { allClients.erase(it); } } }
/** * \brief 从容器中移除断开的连接 * \param flClient 待移除的连接 */ void FLClientManager::remove(FLClient *flClient) { Zebra::logger->debug("FLClientManager::remove"); if (flClient) { zRWLock_scope_wrlock scope_wrlock(rwlock); iter it = allClients.find(flClient->getTempID()); if (it != allClients.end()) { allClients.erase(it); } } }
/** * \brief 向容器中添加已经成功的连接 * \param flClient 待添加的连接 */ void FLClientManager::add(FLClient *flClient) { Zebra::logger->debug("FLClientManager::add"); if (flClient) { zRWLock_scope_wrlock scope_wrlock(rwlock); const_iter it = allClients.find(flClient->getTempID()); if (it == allClients.end()) { allClients.insert(value_type(flClient->getTempID(),flClient)); } } }
bool ServerACL::init() { Zebra::logger->debug("ServerACL::init"); zRWLock_scope_wrlock scope_wrlock(rwlock); datas.clear(); zXMLParser xml; if (!xml.initFile(Zebra::global["confdir"] + "zoneInfo.xml")) { Zebra::logger->error("加载zoneInfo.xml失败"); return false; } xmlNodePtr root = xml.getRootNode("zoneInfo"); if (root) { xmlNodePtr node = xml.getChildNode(root,"zone"); while(node) { if (0 == strcmp((char *)node->name,"zone")) { ACLZone zone; xml.getNodePropNum(node,"game",&zone.gameZone.game,sizeof(zone.gameZone.game)); xml.getNodePropNum(node,"zone",&zone.gameZone.zone,sizeof(zone.gameZone.zone)); xml.getNodePropStr(node,"ip",zone.ip); xml.getNodePropNum(node,"port",&zone.port,sizeof(zone.port)); xml.getNodePropStr(node,"name",zone.name); xml.getNodePropStr(node,"desc",zone.desc); if (!add(zone)) { Zebra::logger->warn("game=%u,zone=%u,ip=%s,port=%u,name=%s,desc=%s", zone.gameZone.game, zone.gameZone.zone, zone.ip.c_str(), zone.port, zone.name.c_str(), zone.desc.c_str()); } } node = xml.getNextNode(node,NULL); } } Zebra::logger->info("加载区信息列表文件成功"); return true; }