From: Remi Gacogne Date: Fri, 19 Apr 2019 15:04:44 +0000 (+0200) Subject: dnsdist: Handle h2o_evloop_run() returning -1 with errno set to EINTR X-Git-Tag: dnsdist-1.4.0-alpha2~6^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50f53f00249e9b2e24e1094a045a0e14f05ac960;p=pdns dnsdist: Handle h2o_evloop_run() returning -1 with errno set to EINTR --- diff --git a/pdns/dnsdistdist/doh.cc b/pdns/dnsdistdist/doh.cc index 5e01af7d6..12d4d6983 100644 --- a/pdns/dnsdistdist/doh.cc +++ b/pdns/dnsdistdist/doh.cc @@ -711,12 +711,22 @@ try throw std::runtime_error("DOH server failed to listen on " + df->d_local.toStringWithPort() + ": " + strerror(errno)); } - while (h2o_evloop_run(dsc->h2o_ctx.loop, INT32_MAX) == 0) - ; - } - catch(const std::exception& e) { - throw runtime_error("DOH thread failed to launch: " + std::string(e.what())); - } - catch(...) { - throw runtime_error("DOH thread failed to launch"); - } + bool stop = false; + do { + int result = h2o_evloop_run(dsc->h2o_ctx.loop, INT32_MAX); + if (result == -1) { + if (errno != EINTR) { + errlog("Error in the DoH event loop: %s", strerror(errno)); + stop = true; + } + } + } + while (stop == false); + +} +catch(const std::exception& e) { + throw runtime_error("DOH thread failed to launch: " + std::string(e.what())); +} +catch(...) { + throw runtime_error("DOH thread failed to launch"); +}