]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Put a timeout on the rtsp writeback call.
authorMike Brady <mikebrady@eircom.net>
Fri, 16 Nov 2018 10:05:37 +0000 (10:05 +0000)
committerMike Brady <mikebrady@eircom.net>
Fri, 16 Nov 2018 10:05:37 +0000 (10:05 +0000)
rtsp.c

diff --git a/rtsp.c b/rtsp.c
index 4663470a1cb334dfeb98ef0b5a5a5785e315b881..352088cb859eaba50d9f23c9aee29a4d58066402 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -2220,6 +2220,13 @@ void rtsp_listen_loop(void) {
     // See: https://github.com/mikebrady/shairport-sync/issues/329
     fcntl(fd, F_SETFD, FD_CLOEXEC);
     ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
+    
+    struct timeval tv;
+    tv.tv_sec = 3; // three seconds write timeout
+    tv.tv_usec = 0;
+    if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (const char *)&tv, sizeof tv) == -1)
+      debug(1, "Error %d setting send timeout for rtsp writeback.", errno);
+
 
 #ifdef IPV6_V6ONLY
     // some systems don't support v4 access on v6 sockets, but some do.