From a0779edec42c13bf52b937a848bb18e16e57f735 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 30 Dec 2016 11:08:26 +0900 Subject: [PATCH 1/2] nghttpx: Fix bug that DNS timeout was ignored --- src/shrpx_dns_resolver.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shrpx_dns_resolver.cc b/src/shrpx_dns_resolver.cc index 87b418c2..32dfc0a6 100644 --- a/src/shrpx_dns_resolver.cc +++ b/src/shrpx_dns_resolver.cc @@ -99,6 +99,7 @@ namespace { void timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { auto resolv = static_cast(w->data); resolv->on_timeout(); + process_result(resolv); } } // namespace From d1ba43a69f939596f787ebed663dd66b0bef6654 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 30 Dec 2016 11:09:02 +0900 Subject: [PATCH 2/2] nghttpx: Fix bug that DNS timeout was erroneously disabled --- src/shrpx_dns_resolver.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shrpx_dns_resolver.cc b/src/shrpx_dns_resolver.cc index 32dfc0a6..d7c77ebd 100644 --- a/src/shrpx_dns_resolver.cc +++ b/src/shrpx_dns_resolver.cc @@ -216,7 +216,9 @@ void DNSResolver::reset_timeout() { if (tv == nullptr) { 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_); }