PeerPtr ChannelServerApp::startChannel( const Mercury::Address & addr, Mercury::Channel::Traits traits ) { INFO_MSG( "Creating channel to %s\n", addr.c_str() ); PeerPtr pPeer = new Peer( nub_, addr, traits ); peers_[ addr ] = pPeer; pPeer->startTimer( nub_, g_tickRate, this ); return pPeer; }
void ChannelServerApp::disconnect( const Mercury::Address & srcAddr, const ServerInterface::disconnectArgs & args ) { Peers::iterator peerIter = peers_.find( srcAddr ); if (peerIter != peers_.end()) { peerIter->second->disconnect( args.seq ); peers_.erase( peerIter ); if (peers_.empty()) { this->nub().breakProcessing(); } } else { ERROR_MSG( "ChannelServerApp::disconnectArgs: " "Got message from unknown peer at %s\n", srcAddr.c_str() ); } }
//------------------------------------------------------------------------------------- void ServerConfig::updateInfos(bool isPrint, COMPONENT_TYPE componentType, COMPONENT_ID componentID, const Mercury::Address& internalAddr, const Mercury::Address& externalAddr) { if(componentType == CELLAPP_TYPE) { ENGINE_COMPONENT_INFO info = getCellApp(); info.internalAddr = &internalAddr; info.externalAddr = &externalAddr; info.componentID = componentID; if(isPrint) { INFO_MSG("server-configs:\n"); INFO_MSG("\tgameUpdateHertz : %d\n", gameUpdateHertz()); INFO_MSG("\tdefaultAoIRadius : %f\n", info.defaultAoIRadius); INFO_MSG("\tdefaultAoIHysteresisArea : %f\n", info.defaultAoIHysteresisArea); INFO_MSG("\tentryScriptFile : %s\n", info.entryScriptFile); INFO_MSG("\tinternalAddr : %s\n", internalAddr.c_str()); //INFO_MSG("\texternalAddr : %s\n", externalAddr.c_str()); INFO_MSG("\tcomponentID : %"PRAppID"\n", info.componentID); } } else if (componentType == BASEAPP_TYPE) { ENGINE_COMPONENT_INFO info = getBaseApp(); info.internalAddr = const_cast<Mercury::Address*>(&internalAddr); info.externalAddr = const_cast<Mercury::Address*>(&externalAddr); info.componentID = componentID; if(isPrint) { INFO_MSG("server-configs:\n"); INFO_MSG("\tgameUpdateHertz : %d\n", gameUpdateHertz()); INFO_MSG("\tdefaultAoIRadius : %f\n", info.defaultAoIRadius); INFO_MSG("\tdefaultAoIHysteresisArea : %f\n", info.defaultAoIHysteresisArea); INFO_MSG("\tentryScriptFile : %s\n", info.entryScriptFile); INFO_MSG("\tinternalAddr : %s\n", internalAddr.c_str()); INFO_MSG("\texternalAddr : %s\n", externalAddr.c_str()); INFO_MSG("\tcomponentID : %"PRAppID"\n", info.componentID); } } else if (componentType == BASEAPPMGR_TYPE) { ENGINE_COMPONENT_INFO info = getBaseAppMgr(); info.internalAddr = const_cast<Mercury::Address*>(&internalAddr); info.externalAddr = const_cast<Mercury::Address*>(&externalAddr); info.componentID = componentID; if(isPrint) { INFO_MSG("server-configs:\n"); INFO_MSG("\tinternalAddr : %s\n", internalAddr.c_str()); //INFO_MSG("\texternalAddr : %s\n", externalAddr.c_str()); INFO_MSG("\tcomponentID : %"PRAppID"\n", info.componentID); } } else if (componentType == CELLAPPMGR_TYPE) { ENGINE_COMPONENT_INFO info = getCellAppMgr(); info.internalAddr = const_cast<Mercury::Address*>(&internalAddr); info.externalAddr = const_cast<Mercury::Address*>(&externalAddr); info.componentID = componentID; if(isPrint) { INFO_MSG("server-configs:\n"); INFO_MSG("\tinternalAddr : %s\n", internalAddr.c_str()); //INFO_MSG("\texternalAddr : %s\n", externalAddr.c_str()); INFO_MSG("\tcomponentID : %"PRAppID"\n", info.componentID); } } else if (componentType == DBMGR_TYPE) { ENGINE_COMPONENT_INFO info = getDBMgr(); info.internalAddr = const_cast<Mercury::Address*>(&internalAddr); info.externalAddr = const_cast<Mercury::Address*>(&externalAddr); info.componentID = componentID; if(isPrint) { INFO_MSG("server-configs:\n"); INFO_MSG("\tinternalAddr : %s\n", internalAddr.c_str()); //INFO_MSG("\texternalAddr : %s\n", externalAddr.c_str()); INFO_MSG("\tcomponentID : %"PRAppID"\n", info.componentID); } } else if (componentType == LOGINAPP_TYPE) { ENGINE_COMPONENT_INFO info = getLoginApp(); info.internalAddr = const_cast<Mercury::Address*>(&internalAddr); info.externalAddr = const_cast<Mercury::Address*>(&externalAddr); info.componentID = componentID; if(isPrint) { INFO_MSG("server-configs:\n"); INFO_MSG("\tinternalAddr : %s\n", internalAddr.c_str()); INFO_MSG("\texternalAddr : %s\n", externalAddr.c_str()); INFO_MSG("\tcomponentID : %"PRAppID"\n", info.componentID); } } else if (componentType == MACHINE_TYPE) { ENGINE_COMPONENT_INFO info = getKBMachine(); info.internalAddr = const_cast<Mercury::Address*>(&internalAddr); info.externalAddr = const_cast<Mercury::Address*>(&externalAddr); info.componentID = componentID; if(isPrint) { INFO_MSG("server-configs:\n"); INFO_MSG("\tinternalAddr : %s\n", internalAddr.c_str()); //INFO_MSG("\texternalAddr : %s\n", externalAddr.c_str()); INFO_MSG("\tcomponentID : %"PRAppID"\n", info.componentID); } } }