aboutsummaryrefslogtreecommitdiff
path: root/src/Http.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Http.hpp')
-rw-r--r--src/Http.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Http.hpp b/src/Http.hpp
index 1058564..2c3b13a 100644
--- a/src/Http.hpp
+++ b/src/Http.hpp
@@ -357,6 +357,10 @@ socket_t create_socket(const char* host, int port, Fn fn, int socket_flags = 0)
// Make 'reuse address' option available
int yes = 1;
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(yes));
+ // set a less conservative socket timeout
+ yes = 30000; // 30s timeout
+ setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&yes, sizeof(yes));
+ setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char*)&yes, sizeof(yes));
// bind or connect
if (fn(sock, *rp)) {