aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorToni Uhlig <Toni.Uhlig@tq-group.com>2017-12-05 11:07:29 +0100
committerToni Uhlig <Toni.Uhlig@tq-group.com>2017-12-05 11:07:29 +0100
commitaca4821babd7b6eed20b114a9f6c26e8f978198f (patch)
tree4a645ffd1aa0a802bdb14e7b458c284be2b92618 /src
parente2d13e792c7a035e8552a35508f8efa5a864ce09 (diff)
Http: set socket recv/send timeout (30s)
Diffstat (limited to 'src')
-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)) {