From e580c3a2f6534d76e94d6d940df1a138791e803e Mon Sep 17 00:00:00 2001 From: BenDroid Date: Fri, 29 Dec 2017 19:50:14 +0100 Subject: [PATCH] Added fix for miner to retry when server is not reachable --- src/3rdparty/cpp-httplib/httplib.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/3rdparty/cpp-httplib/httplib.h b/src/3rdparty/cpp-httplib/httplib.h index e1a85215..4b7b2177 100644 --- a/src/3rdparty/cpp-httplib/httplib.h +++ b/src/3rdparty/cpp-httplib/httplib.h @@ -357,6 +357,13 @@ socket_t create_socket(const char* host, int port, Fn fn, int socket_flags = 0) int yes = 1; setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(yes)); + struct timeval timeout; + timeout.tv_sec = 5; + timeout.tv_usec = 0; + + setsockopt (sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout)); + setsockopt (sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout)); + // bind or connect if (fn(sock, *rp)) { freeaddrinfo(result);