mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
limit the latency within server browser entries to a maximum of 999
This commit is contained in:
parent
7a20c313ee
commit
7ca7c95bc0
|
@ -2,6 +2,7 @@
|
|||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
#include <algorithm> // sort
|
||||
|
||||
#include <base/math.h>
|
||||
#include <base/system.h>
|
||||
#include <engine/shared/network.h>
|
||||
#include <engine/shared/protocol.h>
|
||||
|
@ -440,9 +441,9 @@ void CServerBrowser::Set(const NETADDR &Addr, int Type, int Token, const CServer
|
|||
{
|
||||
SetInfo(pEntry, *pInfo);
|
||||
if(m_ServerlistType == IServerBrowser::TYPE_LAN)
|
||||
pEntry->m_Info.m_Latency = (time_get()-m_BroadcastTime)*1000/time_freq();
|
||||
pEntry->m_Info.m_Latency = min(static_cast<int>((time_get()-m_BroadcastTime)*1000/time_freq()), 999);
|
||||
else
|
||||
pEntry->m_Info.m_Latency = (time_get()-pEntry->m_RequestTime)*1000/time_freq();
|
||||
pEntry->m_Info.m_Latency = min(static_cast<int>((time_get()-pEntry->m_RequestTime)*1000/time_freq()), 999);
|
||||
RemoveRequest(pEntry);
|
||||
}
|
||||
}
|
||||
|
@ -454,9 +455,9 @@ void CServerBrowser::Set(const NETADDR &Addr, int Type, int Token, const CServer
|
|||
SetInfo(pEntry, *pInfo);
|
||||
|
||||
if(m_ServerlistType == IServerBrowser::TYPE_LAN)
|
||||
pEntry->m_Info.m_Latency = (time_get()-m_BroadcastTime)*1000/time_freq();
|
||||
pEntry->m_Info.m_Latency = min(static_cast<int>((time_get()-m_BroadcastTime)*1000/time_freq()), 999);
|
||||
else
|
||||
pEntry->m_Info.m_Latency = (time_get()-pEntry->m_RequestTime)*1000/time_freq();
|
||||
pEntry->m_Info.m_Latency = min(static_cast<int>((time_get()-pEntry->m_RequestTime)*1000/time_freq()), 999);
|
||||
RemoveRequest(pEntry);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue