[FFmpeg-cvslog] tcp: Try enabling SO_REUSEADDR when listening

Martin Storsjö git at videolan.org
Fri Jun 1 20:05:37 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed May 30 17:37:51 2012 +0300| [b7c3772be855f95f0e1903daf48c4c0246d680fb] | committer: Martin Storsjö

tcp: Try enabling SO_REUSEADDR when listening

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7c3772be855f95f0e1903daf48c4c0246d680fb
---

 libavformat/tcp.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index e249e4e..a6eeeb0 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -83,6 +83,8 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
 
     if (listen_socket) {
         int fd1;
+        int reuse = 1;
+        setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
         ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
         if (ret) {
             ret = ff_neterrno();



More information about the ffmpeg-cvslog mailing list