X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=blobdiff_plain;f=src%2Fevent.c;fp=src%2Fevent.c;h=845bc690af88a80a3308d2ef3f5c89cb1baa3902;hp=28cc60cbeac9f40a09319020d8176a311883d4d6;hb=514c20aa99cd2f29c7e5da1e263ab7e81e3a9ff3;hpb=3f3b27e453cd6b8f36c7375cfdd67235314838a9 diff --git a/src/event.c b/src/event.c index 28cc60c..845bc69 100644 --- a/src/event.c +++ b/src/event.c @@ -149,6 +149,11 @@ void adns__tcp_tryconnect(adns_state ads, struct timeval now) { /* Timeout handling functions. */ +void adns__timeout_set(adns_query qu, struct timeval now, int ms) { + qu->timeout_expires= now; + timevaladd(&qu->timeout_expires,ms); +} + void adns__must_gettimeofday(adns_state ads, const struct timeval **now_io, struct timeval *tv_buf) { const struct timeval *now; @@ -212,8 +217,8 @@ static void timeouts_queue(adns_state ads, int act, for (qu= queue->head; qu; qu= nqu) { nqu= qu->next; - if (!timercmp(&now,&qu->timeout,>)) { - inter_maxtoabs(tv_io,tvbuf,now,qu->timeout); + if (!timercmp(&now,&qu->timeout_expires,>)) { + inter_maxtoabs(tv_io,tvbuf,now,qu->timeout_expires); } else { if (!act) { inter_immed(tv_io,tvbuf); return; } LIST_UNLINK(*queue,qu);