diff mbox series

[FFmpeg-devel] Added SO_KEEPALIVE in TCP sockets, so kernel keepalive settings manage timeouts in case of TCP hangs

Message ID 05a1e2e4-6681-fbef-0fa6-80fcd5c26a12@cinfo.es
State New
Headers show
Series [FFmpeg-devel] Added SO_KEEPALIVE in TCP sockets, so kernel keepalive settings manage timeouts in case of TCP hangs | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_armv7_RPi4 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

David Maseda Neira June 7, 2022, 3:46 p.m. UTC
Signed-off-by: David Maseda Neira <david.maseda@cinfo.es>
---
  libavformat/network.c | 6 ++++++
  1 file changed, 6 insertions(+)

      return fd;
  }
  -- 2.36.1
diff mbox series

Patch

diff --git a/libavformat/network.c b/libavformat/network.c
index 21e20b3e9a..0361346631 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -204,6 +204,12 @@  int ff_socket(int af, int type, int proto, void 
*logctx)
          }
      }
  #endif
+    if(type == SOCK_STREAM)
+    {
+        if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &(int){1}, 
sizeof(int))) {
+            av_log(logctx, AV_LOG_WARNING, "setsockopt(SO_KEEPALIVE) 
failed\n");
+        }
+    }