From: rousskov <> Date: Wed, 8 Apr 1998 05:50:54 +0000 (+0000) Subject: - a compact version of netdbHostPeerRtt with rounding as in netdbHostRtt X-Git-Tag: SQUID_3_0_PRE1~3597 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6acd17068639310896244ab9eb4d458aa21ebcb;p=thirdparty%2Fsquid.git - a compact version of netdbHostPeerRtt with rounding as in netdbHostRtt --- diff --git a/src/net_db.cc b/src/net_db.cc index 14bf1a486d..c37f805f46 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.82 1998/04/04 05:02:49 wessels Exp $ + * $Id: net_db.cc,v 1.83 1998/04/07 23:50:54 rousskov Exp $ * * DEBUG: section 37 Network Measurement Database * AUTHOR: Duane Wessels @@ -662,18 +662,11 @@ int netdbHostPeerRtt(const char *host, peer * peer) { #if USE_ICMP - netdbEntry *n = netdbLookupHost(host); - net_db_peer *p; - int i; - if (NULL == n) - return 0; - p = n->peers; - for (i = 0; i < n->n_peers; i++, p++) { - if (strcmp(p->peername, peer->host)) - continue; - if (p->expires < squid_curtime) - break; - return p->rtt; + const netdbEntry *n = netdbLookupHost(host); + if (n) { + const net_db_peer *p = netdbPeerByName(n, peer->host); + if (p && p->expires >= squid_curtime) + return (int) (p->rtt + 0.5); } #endif return 0;