Hotfix for Refresh

This commit is contained in:
Patrick Rathje 2014-01-03 16:14:41 +01:00 committed by def
parent 4c080fe137
commit 5114570794
4 changed files with 52 additions and 11 deletions

View file

@ -693,9 +693,9 @@ int net_host_lookup(const char *hostname, NETADDR *addr, int types)
if(priv_net_extract(hostname, host, sizeof(host), &port)) if(priv_net_extract(hostname, host, sizeof(host), &port))
return -1; return -1;
/*
dbg_msg("host lookup", "host='%s' port=%d %d", host, port, types); dbg_msg("host lookup", "host='%s' port=%d %d", host, port, types);
*/
mem_zero(&hints, sizeof(hints)); mem_zero(&hints, sizeof(hints));

View file

@ -936,14 +936,19 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
{ {
if(!m_pMasterServer->IsValid(i)) if(!m_pMasterServer->IsValid(i))
continue; continue;
if(net_addr_comp(&pPacket->m_Address, &m_pMasterServer->GetAddr(i)) == 0) NETADDR tmp = m_pMasterServer->GetAddr(i);
if(net_addr_comp(&pPacket->m_Address, &tmp) == 0)
{ {
ServerID = i; ServerID = i;
break; break;
} }
} }
if(ServerCount > -1 && ServerID != -1) if(ServerCount > -1 && ServerID != -1)
{
m_pMasterServer->SetCount(ServerID, ServerCount); m_pMasterServer->SetCount(ServerID, ServerCount);
if(g_Config.m_Debug)
dbg_msg("MasterCount", "Server %d got %d servers", ServerID, ServerCount);
}
} }
// server list from master server // server list from master server
if(pPacket->m_DataSize >= (int)sizeof(SERVERBROWSE_LIST) && if(pPacket->m_DataSize >= (int)sizeof(SERVERBROWSE_LIST) &&

View file

@ -636,9 +636,13 @@ void CServerBrowser::Update(bool ForceResort)
int Count = m_pMasterServer->GetCount(i); int Count = m_pMasterServer->GetCount(i);
if(Count == -1) if(Count == -1)
{ {
/* ignore Server
m_MasterServerCount = -1; m_MasterServerCount = -1;
return; // we don't have the required server information return;
// we don't have the required server information
*/
} }
else
m_MasterServerCount += Count; m_MasterServerCount += Count;
} }
//request Server-List //request Server-List
@ -665,6 +669,30 @@ void CServerBrowser::Update(bool ForceResort)
} }
m_LastPacketTick = 0; m_LastPacketTick = 0;
} }
else if(m_MasterServerCount > -1)
{
m_MasterServerCount = 0;
for(int i = 0; i < IMasterServer::MAX_MASTERSERVERS; i++)
{
if(!m_pMasterServer->IsValid(i))
continue;
int Count = m_pMasterServer->GetCount(i);
if(Count == -1)
{
/* ignore Server
m_MasterServerCount = -1;
return;
// we don't have the required server information
*/
}
else
m_MasterServerCount += Count;
}
if(g_Config.m_Debug)
{
dbg_msg("client_srvbrowse", "ServerCount2: %d", m_MasterServerCount);
}
}
if(m_MasterServerCount > m_NumRequests + m_LastPacketTick) if(m_MasterServerCount > m_NumRequests + m_LastPacketTick)
{ {
++m_LastPacketTick; ++m_LastPacketTick;

View file

@ -55,7 +55,9 @@ public:
{ {
m_pEngine->HostLookup(&m_aMasterServers[i].m_Lookup, m_aMasterServers[i].m_aHostname, Nettype); m_pEngine->HostLookup(&m_aMasterServers[i].m_Lookup, m_aMasterServers[i].m_aHostname, Nettype);
m_aMasterServers[i].m_Valid = false; m_aMasterServers[i].m_Valid = false;
m_aMasterServers[i].m_Count = -1; m_aMasterServers[i].m_Count = 0;
//dbg_msg("MasterServer", "Lookup id: %d, name: %s, nettype: %d", i, m_aMasterServers[i].m_aHostname, Nettype);
} }
m_State = STATE_UPDATE; m_State = STATE_UPDATE;
@ -80,9 +82,15 @@ public:
m_aMasterServers[i].m_Addr = m_aMasterServers[i].m_Lookup.m_Addr; m_aMasterServers[i].m_Addr = m_aMasterServers[i].m_Lookup.m_Addr;
m_aMasterServers[i].m_Addr.port = 8300; m_aMasterServers[i].m_Addr.port = 8300;
m_aMasterServers[i].m_Valid = true; m_aMasterServers[i].m_Valid = true;
//dbg_msg("MasterServer", "Set server %d, name: %s with addr-port: %d addr-ip %s addr-type %d", i, m_aMasterServers[i].m_aHostname, m_aMasterServers[i].m_Addr.port, m_aMasterServers[i].m_Addr.ip, m_aMasterServers[i].m_Addr.type);
} }
else else
{
m_aMasterServers[i].m_Valid = false; m_aMasterServers[i].m_Valid = false;
// dbg_msg("MasterServer", "Dropped %d, name: %s with addr-port: %d addr-ip %s addr-type %d", i, m_aMasterServers[i].m_aHostname);
}
} }
} }