| 798 | } |
| 799 | |
| 800 | void CServerBrowser::SetLatency(NETADDR Addr, int Latency) |
| 801 | { |
| 802 | m_pPingCache->CachePing(Addr, Latency); |
| 803 | |
| 804 | Addr.port = 0; |
| 805 | for(CServerEntry *pEntry : m_vpServerlist) |
| 806 | { |
| 807 | if(!pEntry->m_GotInfo) |
| 808 | { |
| 809 | continue; |
| 810 | } |
| 811 | bool Found = false; |
| 812 | for(int i = 0; i < pEntry->m_Info.m_NumAddresses; i++) |
| 813 | { |
| 814 | NETADDR Other = pEntry->m_Info.m_aAddresses[i]; |
| 815 | Other.port = 0; |
| 816 | if(Addr == Other) |
| 817 | { |
| 818 | Found = true; |
| 819 | break; |
| 820 | } |
| 821 | } |
| 822 | if(!Found) |
| 823 | { |
| 824 | continue; |
| 825 | } |
| 826 | int Ping = m_pPingCache->GetPing(pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses); |
| 827 | if(Ping == -1) |
| 828 | { |
| 829 | continue; |
| 830 | } |
| 831 | pEntry->m_Info.m_Latency = Ping; |
| 832 | pEntry->m_Info.m_LatencyIsEstimated = false; |
| 833 | } |
| 834 | } |
| 835 | |
| 836 | CServerBrowser::CServerEntry *CServerBrowser::Add(const NETADDR *pAddrs, int NumAddrs) |
| 837 | { |