コード例 #1
0
void CLobbyApp::UpdatePerfCounters()
{
  static CTempTimer timerPerfCounters("assembling perf info", .05f);
  timerPerfCounters.Start();
  m_fmClients.GetSendQueue(&(m_pCounters->cOutboundQueueLength),
                           &(m_pCounters->cOutboundQueueSize));
  m_fmClients.GetReceiveQueue(&(m_pCounters->cInboundQueueLength),
                              &(m_pCounters->cInboundQueueSize));

  m_pCounters->cPlayersLobby = m_fmClients.GetCountConnections();
  m_pCounters->cServers = m_fmServers.GetConnectionCount();

  // Get all the per server stuff, and agregate the count of missions and players
  ListConnections::Iterator iterCnxn(*m_fmServers.GetConnections());
  int cMissions = 0;
  DWORD cPlayers = 0;
  while (!iterCnxn.End())
  {
    CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value());
    cMissions += (pServerT->GetCounters()->cMissions = pServerT->GetMissions()->GetCount());
    cPlayers  += (pServerT->GetCounters()->cPlayers    = pServerT->GetPlayerCount());
    pServerT->GetCounters()->percentLoad = pServerT->GetPercentLoad();
    iterCnxn.Next();
  }
  m_pCounters->cMissions = cMissions;
  m_pCounters->cPlayersMissions = cPlayers;
  timerPerfCounters.Stop();
}
コード例 #2
0
ファイル: lobbyapp.cpp プロジェクト: LordBlacksun/Allegiance
void CLobbyApp::SendGameInfo()
{
  ZGameServerInfoMsg* gameInfo = GetGameServerInfoMsg();
  SetVariableGameInfo();
  //must do endian so both side of network get correct numbers
  //gameinfo used on Unix and Intel boxes
  //note that doing this once will invalidate all numbers
  //so set gameInfo->info[0] numbers again.
  ZGameInstanceInfoMsgEndian( gameInfo->info );
  
  //send, usually to many Ip addresses which are Zone Web servers, so add this to your game configuration
  for (int i = 0; i < m_cReportServers; i++)
    ZGameInfoSendTo(m_rgulIP[i], 2000, GetGameServerInfoMsg(), sizeof(m_GameInfoBuf));

  //Imago 9/14
	if (m_fmServers.GetConnections()->GetCount() > 0) {
		int offset = 0;
		char * PostData = new char[BUFFSIZE];
		ZeroMemory(PostData,BUFFSIZE);
		ListConnections::Iterator iterCnxn(*m_fmServers.GetConnections());
		while (!iterCnxn.End()) {
			CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value());
			MissionList::Iterator iterMission(*pServerT->GetMissions());
			while (!iterMission.End()){
				CFLMission* mission = iterMission.Value();
				FMD_LS_LOBBYMISSIONINFO *info = mission->GetMissionInfo();
				if (info) {
					memcpy(PostData + offset, info, info->cbmsg);
					offset += info->cbmsg;
					iterMission.Next();
				}
			}
			iterCnxn.Next();
		}
		if (offset > 0) {
			 pHTTP settings;
			 Strcpy(settings.hdrs,"Content-Type: application/octet-stream\r\n");
			 Strcpy(settings.verb,"POST");
			 Strcpy(settings.uri,"/lobbyinfo.ashx");
			 Strcpy(settings.host,"allegiancezone.com");
			 ZeroMemory(settings.data,BUFFSIZE);
			 memcpy(settings.data,PostData,offset);
			 settings.size = offset;
			 DWORD lpExitCode;
			 GetExitCodeThread(m_threadPost,&lpExitCode);
			 if (lpExitCode != STILL_ACTIVE) {
				debugf("Creating post thread.\n");
				DWORD dum;
				m_threadPost = CreateThread(NULL, 0, PostThread, (void*)&settings, 0, &dum);
			 } else
				 debugf("Post thread was still running...\n");
		}
	}
}
コード例 #3
0
void CLobbyApp::SendGameInfoToAz()
{
	//Imago 9/14
	if (m_fmServers.GetConnections()->GetCount() > 0) {
		int offset = 0;
		char * PostData = new char[BUFFSIZE];
		ZeroMemory(PostData, BUFFSIZE);
		ListConnections::Iterator iterCnxn(*m_fmServers.GetConnections());
		while (!iterCnxn.End()) {
			CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value());
			MissionList::Iterator iterMission(*pServerT->GetMissions());
			while (!iterMission.End()){
				CFLMission* mission = iterMission.Value();
				FMD_LS_LOBBYMISSIONINFO *info = mission->GetMissionInfo();
				if (info) {
					memcpy(PostData + offset, info, info->cbmsg);
					offset += info->cbmsg;
					iterMission.Next();
				}
			}
			iterCnxn.Next();
		}
		if (offset > 0) {
			pHTTP settings;
			Strcpy(settings.hdrs, "Content-Type: application/octet-stream\r\n");
			Strcpy(settings.verb, "POST");
			Strcpy(settings.uri, "/lobbyinfo.ashx");
			Strcpy(settings.host, "allegiancezone.com"); 
			ZeroMemory(settings.data, BUFFSIZE);
			memcpy(settings.data, PostData, offset);
			settings.size = offset;
			DWORD lpExitCode;
			GetExitCodeThread(m_threadPost, &lpExitCode);
			if (lpExitCode != STILL_ACTIVE) {
				debugf("Creating post thread.\n");
				DWORD dum;
				m_threadPost = CreateThread(NULL, 0, PostThread, (void*)&settings, 0, &dum);
			}
			else
				debugf("Post thread was still running...\n");
		}
	}
}