diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 8ecc644d5..46fae2876 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -924,7 +924,7 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket) m_MapChecker.AddMaplist((CMapVersion *)((char*)pPacket->m_pData+sizeof(VERSIONSRV_MAPLIST)), Num); } } - + //server count from master server if(pPacket->m_DataSize == (int) sizeof(SERVERBROWSE_COUNT) + 2 && mem_comp(pPacket->m_pData, SERVERBROWSE_COUNT, sizeof(SERVERBROWSE_COUNT)) == 0) { diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp index 92a27be4c..0ea730a9a 100644 --- a/src/engine/client/serverbrowser.cpp +++ b/src/engine/client/serverbrowser.cpp @@ -479,7 +479,7 @@ void CServerBrowser::Refresh(int Type) m_pFirstReqServer = 0; m_pLastReqServer = 0; m_NumRequests = 0; - m_CurrentMaxRequests = (1<IsRefreshing()) { @@ -617,8 +617,11 @@ void CServerBrowser::Update(bool ForceResort) Addr = m_pMasterServer->GetAddr(i); m_pMasterServer->SetCount(i, -1); Packet.m_Address = Addr; - m_pNetClient->Send(&Packet); - dbg_msg("send to", "%d", i); + m_pNetClient->Send(&Packet); + if(g_Config.m_Debug) + { + dbg_msg("client_srvbrowse", "Count-Request sent to %d", i); + } } } @@ -657,29 +660,16 @@ void CServerBrowser::Update(bool ForceResort) m_pNetClient->Send(&Packet); } if(g_Config.m_Debug) - m_pConsole->Print(IConsole::OUTPUT_LEVEL_DEBUG, "client_srvbrowse", "requesting server list"); - dbg_msg("msg", "%d", m_MasterServerCount); + { + dbg_msg("client_srvbrowse", "ServerCount: %d, requesting server list", m_MasterServerCount); + } m_LastPacketTick = 0; - } - - - - + } if(m_MasterServerCount > m_NumRequests + m_LastPacketTick) { ++m_LastPacketTick; return; //wait for more packets } - - - - - - - - - - pEntry = m_pFirstReqServer; Count = 0; while(1) @@ -718,7 +708,9 @@ void CServerBrowser::Update(bool ForceResort) } //update max-requests - m_CurrentMaxRequests = (m_CurrentMaxRequests>>1); + m_CurrentMaxRequests = m_CurrentMaxRequests/2; + if(m_CurrentMaxRequests < 1) + m_CurrentMaxRequests = 1; } else if(Count == 0 && m_CurrentMaxRequests == 1) //we reached the limit, just release all left requests. IF a server sends us a packet, a new request will be added automatically, so we can delete all { diff --git a/src/engine/client/serverbrowser.h b/src/engine/client/serverbrowser.h index 2a7207dac..332a3f867 100644 --- a/src/engine/client/serverbrowser.h +++ b/src/engine/client/serverbrowser.h @@ -74,8 +74,11 @@ private: int m_NumRequests; int m_MasterServerCount; + //used instead of g_Config.br_max_requests to get more servers + int m_CurrentMaxRequests; + int m_LastPacketTick; - + int m_NeedRefresh; int m_NumSortedServers; diff --git a/src/engine/masterserver.h b/src/engine/masterserver.h index 208ec1f4e..b26c4c69f 100644 --- a/src/engine/masterserver.h +++ b/src/engine/masterserver.h @@ -24,7 +24,7 @@ public: virtual void Update() = 0; virtual int IsRefreshing() = 0; virtual NETADDR GetAddr(int Index) = 0; - virtual void SetCount(int Index, int Count) = 0; + virtual void SetCount(int Index, int Count) = 0; virtual int GetCount(int Index) = 0; virtual const char *GetName(int Index) = 0; virtual bool IsValid(int Index) = 0;