summaryrefslogtreecommitdiffstats
path: root/streaming/receiver.c
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2022-04-20 10:53:20 +0300
committerGitHub <noreply@github.com>2022-04-20 10:53:20 +0300
commit0f18a33d2a0627400f4af138278a10f72c501336 (patch)
treed32f93d517616c074b527110d6887241e9842a5b /streaming/receiver.c
parent69ca5926baf87283fba992dfb0019d684dc8297b (diff)
Add a 2 minute timeout to stream receiver socket (#12673)
* add a 10min timeout to receiver socket * reduce timeout to 2 min
Diffstat (limited to 'streaming/receiver.c')
-rw-r--r--streaming/receiver.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/streaming/receiver.c b/streaming/receiver.c
index b083766dd9..305934cc48 100644
--- a/streaming/receiver.c
+++ b/streaming/receiver.c
@@ -609,6 +609,11 @@ static int rrdpush_receive(struct receiver_state *rpt)
if(sock_delnonblock(rpt->fd) < 0)
error("STREAM %s [receive from [%s]:%s]: cannot remove the non-blocking flag from socket %d", rpt->host->hostname, rpt->client_ip, rpt->client_port, rpt->fd);
+ struct timeval timeout;
+ timeout.tv_sec = 120;
+ timeout.tv_usec = 0;
+ setsockopt (rpt->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
+
// convert the socket to a FILE *
FILE *fp = fdopen(rpt->fd, "r");
if(!fp) {