From e4ec629d626fd20208780a668264f71b16b1d3a3 Mon Sep 17 00:00:00 2001 From: Michael van der Werve Date: Mon, 23 Nov 2020 09:57:35 +0100 Subject: [PATCH] signals can interrupt poll, which is now taken as a failure but should be retried --- src/linux_tcp/tcpresolver.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/linux_tcp/tcpresolver.h b/src/linux_tcp/tcpresolver.h index d45a602e..d4af8de0 100644 --- a/src/linux_tcp/tcpresolver.h +++ b/src/linux_tcp/tcpresolver.h @@ -129,8 +129,17 @@ class TcpResolver : public TcpExtState fd.events = POLLOUT; fd.revents = 0; - // perform the poll, with a very long time to allow the event to occur - int ret = poll(&fd, 1, _timeout * 1000); + // the return code + int ret = 0; + + // keep looping until we get a 'final' result + do + { + // perform the poll, with a very long time to allow the event to occur + ret = poll(&fd, 1, _timeout * 1000); + + // we want to retry if the call was interrupted by a signal + } while (ret == -1 && errno == EINTR); // log the error for the time being if (ret == 0) _error = "connection timed out";