Merge branch 'nghttpx-dns-timeout-fix'

This commit is contained in:
Tatsuhiro Tsujikawa 2016-12-30 11:39:28 +09:00
commit 2b6073900f
1 changed files with 4 additions and 1 deletions

View File

@ -99,6 +99,7 @@ namespace {
void timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { void timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
auto resolv = static_cast<DNSResolver *>(w->data); auto resolv = static_cast<DNSResolver *>(w->data);
resolv->on_timeout(); resolv->on_timeout();
process_result(resolv);
} }
} // namespace } // namespace
@ -215,7 +216,9 @@ void DNSResolver::reset_timeout() {
if (tv == nullptr) { if (tv == nullptr) {
return; return;
} }
timer_.repeat = tv->tv_sec + tv->tv_usec / 1000000.; // To avoid that timer_.repeat becomes 0, which makes ev_timer_again
// useless, add tiny fraction of time.
timer_.repeat = tv->tv_sec + tv->tv_usec / 1000000. + 1e-9;
ev_timer_again(loop_, &timer_); ev_timer_again(loop_, &timer_);
} }