コード例 #1
0
ファイル: ServerManager.cpp プロジェクト: Vaion/Server
void ServerManager::DestroyServerByName(string l_name, string s_name, WorldServer *ignore)
{
	list<WorldServer*>::iterator iter = world_servers.begin();
	while(iter != world_servers.end())
	{
		if((*iter) == ignore)
		{
			iter++;
		}

		if((*iter)->GetLongName().compare(l_name) == 0 && (*iter)->GetShortName().compare(s_name) == 0)
		{
			EmuTCPConnection *c = (*iter)->GetConnection();
			if(c->Connected())
			{
				c->Disconnect();
			}
			c->Free();
			delete (*iter);
			iter = world_servers.erase(iter);
		}

		iter++;
	}
}
コード例 #2
0
ファイル: server_manager.cpp プロジェクト: bwilliams1/Server
void ServerManager::ProcessDisconnect()
{
	list<WorldServer*>::iterator iter = world_servers.begin();
	while(iter != world_servers.end())
	{
		EmuTCPConnection *c = (*iter)->GetConnection();
		if(!c->Connected())
		{
			in_addr tmp;
			tmp.s_addr = c->GetrIP();
			server_log->Log(log_network, "World server disconnected from the server, removing server and freeing connection.");
			c->Free();
			delete (*iter);
			iter = world_servers.erase(iter);
		}
		else
		{
			++iter;
		}
	}
}