Added fix for miner to retry when server is not reachable
This commit is contained in:
parent
f14c4aee36
commit
e580c3a2f6
1 changed files with 7 additions and 0 deletions
7
src/3rdparty/cpp-httplib/httplib.h
vendored
7
src/3rdparty/cpp-httplib/httplib.h
vendored
|
@ -357,6 +357,13 @@ socket_t create_socket(const char* host, int port, Fn fn, int socket_flags = 0)
|
||||||
int yes = 1;
|
int yes = 1;
|
||||||
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(yes));
|
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
|
// bind or connect
|
||||||
if (fn(sock, *rp)) {
|
if (fn(sock, *rp)) {
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue