@cryptotaxi247 / netdata-1 / commits / 0f18a33d2

Add a 2 minute timeout to stream receiver socket (#12673)

* add a 10min timeout to receiver socket * reduce timeout to 2 min

Emmanuel Vasilakis committed Apr 20, 2022 at 10:53 UTC 0f18a33d2a0627400f4af138278a10f72c501336
1 file changed +5
streaming/receiver.c
+5
@@ -609,6 +609,11 @@ static int rrdpush_receive(struct receiver_state *rpt)
609 if(sock_delnonblock(rpt->fd) < 0)
610 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);
611
612 + struct timeval timeout;
613 + timeout.tv_sec = 120;
614 + timeout.tv_usec = 0;
615 + setsockopt (rpt->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
616 +
617 // convert the socket to a FILE *
618 FILE *fp = fdopen(rpt->fd, "r");
619 if(!fp) {