* - query submission and cancellation (user-visible and internal)
*/
/*
- * This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson
+ * This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
qu->udpsent= qu->tcpfailed= 0;
timerclear(&qu->timeout);
memcpy(&qu->ctx,ctx,sizeof(qu->ctx));
+ qu->expires= now.tv_sec + MAXTTLBELIEVE;
qu->answer->status= adns_s_ok;
qu->answer->cname= 0;
from->interim_allocd -= sz;
to->interim_allocd += sz;
+
+ if (to->expires > from->expires) to->expires= from->expires;
}
void *adns__alloc_final(adns_query qu, size_t sz) {
free(qu);
}
+void adns__update_expires(adns_query qu, unsigned long ttl, struct timeval now) {
+ time_t max;
+
+ assert(ttl <= MAXTTLBELIEVE);
+ max= now.tv_sec + ttl;
+ if (qu->expires < max) return;
+ qu->expires= max;
+}
+
static void makefinal_query(adns_query qu) {
adns_answer *ans;
int rrn;
for (rrn=0; rrn<ans->nrrs; rrn++)
qu->typei->makefinal(qu, ans->rrs.bytes + rrn*ans->rrsz);
}
-
+
free_query_allocs(qu);
return;
return;
}
adns__isort(ans->rrs.bytes, ans->nrrs, ans->rrsz,
- qu->vb.buf, qu->typei->diff_needswap);
+ qu->vb.buf,
+ (int(*)(void*, const void*, const void*))qu->typei->diff_needswap,
+ qu->ads);
}
+ ans->expires= qu->expires;
parent= qu->parent;
if (parent) {
LIST_UNLINK_PART(parent->children,qu,siblings.);