{
char buf[257];
struct delegpt_addr* a;
- int lame, dlame, rlame, rtt, edns_vs, to;
- int entry_ttl, clean_rtt;
+ int lame, dlame, rlame, rto, edns_vs, to;
+ int entry_ttl;
+ struct rtt_info ri;
uint8_t edns_lame_known;
for(a = dp->target_list; a; a = a->next_target) {
addr_to_str(&a->addr, a->addrlen, buf, sizeof(buf));
}
/* lookup in infra cache */
entry_ttl = infra_get_host_rto(worker->env.infra_cache,
- &a->addr, a->addrlen, &clean_rtt, &rtt,
- *worker->env.now);
+ &a->addr, a->addrlen, &ri, *worker->env.now);
if(entry_ttl == -1) {
if(!ssl_printf(ssl, "not in infra cache.\n"))
return;
continue; /* skip stuff not in infra cache */
- } else if(entry_ttl == -2) {
- if(!ssl_printf(ssl, "not in infra cache.\n"))
- return;
- continue; /* skip stuff not in infra cache */
}
/* uses type_A because most often looked up, but other
* lameness won't be reported then */
if(!infra_get_lame_rtt(worker->env.infra_cache,
&a->addr, a->addrlen, dp->name, dp->namelen,
- LDNS_RR_TYPE_A, &lame, &dlame, &rlame, &rtt,
+ LDNS_RR_TYPE_A, &lame, &dlame, &rlame, &rto,
*worker->env.now)) {
if(!ssl_printf(ssl, "not in infra cache.\n"))
return;
continue; /* skip stuff not in infra cache */
}
- if(!ssl_printf(ssl, "%s%s%s%srtt %d msec, ttl %d",
+ if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl %d, ping %d "
+ "var %d rtt %d",
lame?"LAME ":"", dlame?"NoDNSSEC ":"",
a->lame?"AddrWasParentSide ":"",
- rlame?"NoAuthButRecursive ":"", rtt, entry_ttl))
+ rlame?"NoAuthButRecursive ":"", rto, entry_ttl,
+ ri.srtt, ri.rttvar, rtt_notimeout(&ri)))
return;
- if(rtt != clean_rtt && clean_rtt != 376 /* unknown */) {
- if(!ssl_printf(ssl, ", ping %d", clean_rtt))
- return;
- }
if(infra_host(worker->env.infra_cache, &a->addr, a->addrlen,
*worker->env.now, &edns_vs, &edns_lame_known, &to)) {
if(edns_vs == -1) {
int infra_get_host_rto(struct infra_cache* infra,
struct sockaddr_storage* addr, socklen_t addrlen,
- int* rtt, int* rto, uint32_t timenow)
+ struct rtt_info* rtt, uint32_t timenow)
{
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
addrlen, 0);
struct infra_host_data* data;
- int ttl = -2;
+ int ttl = -1;
if(!e) return -1;
data = (struct infra_host_data*)e->data;
if(data->ttl >= timenow) {
ttl = (int)(data->ttl - timenow);
- *rtt = rtt_notimeout(&data->rtt);
- *rto = rtt_unclamped(&data->rtt);
+ memmove(rtt, &data->rtt, sizeof(*rtt));
}
lock_rw_unlock(&e->lock);
return ttl;
* @param infra: infra cache.
* @param addr: host address.
* @param addrlen: length of addr.
- * @param rtt: the clean rtt time (of working replies).
- * @param rto: the rtt with timeouts applied. (rtt as returned by other funcs).
+ * @param rtt: the rtt_info is copied into here (caller alloced return struct).
* @param timenow: what time it is now.
* @return TTL the infra host element is valid for. If -1: not found in cache.
- * If -2: found in cache, but TTL was not valid.
*/
int infra_get_host_rto(struct infra_cache* infra,
struct sockaddr_storage* addr, socklen_t addrlen,
- int* rtt, int* rto, uint32_t timenow);
+ struct rtt_info* rtt, uint32_t timenow);
/**
* Get memory used by the infra cache.