示例#1
0
void SetPing(server_data *s, int ping)
{
    if (ping < 0)
        strlcpy (s->display.ping, "n/a", sizeof (s->display.ping));
    else
        snprintf (s->display.ping, sizeof (s->display.ping), "%3d", ping > 999 ? 999 : ping);

    s->ping = ping;
	
	SB_Server_SetBestPing(s, -1);
}
示例#2
0
static void SB_PingTree_UpdateServerList(void)
{
	int i;

	SB_ServerList_Lock();

	for (i = 0; i < serversn; i++) {
		nodeid_t id = SB_PingTree_FindIp(SB_Netaddr2Ipaddr(&servers[i]->address));
		if (id == INVALID_NODE || ping_nodes[id].prev == INVALID_NODE || ping_nodes[id].prev == startnode_id) continue;

		SB_Server_SetBestPing(servers[i], ping_nodes[id].dist);
	}

	SB_ServerList_Unlock();
}