[MPlayer-cvslog] r22131 - trunk/stream/tcp.c

rtogni subversion at mplayerhq.hu
Sun Feb 4 15:18:56 CET 2007


Author: rtogni
Date: Sun Feb  4 15:18:56 2007
New Revision: 22131

Modified:
   trunk/stream/tcp.c

Log:
Add timeout to tcp connections, avoid hanging forever.
Based on patch for bugzilla #673


Modified: trunk/stream/tcp.c
==============================================================================
--- trunk/stream/tcp.c	(original)
+++ trunk/stream/tcp.c	Sun Feb  4 15:18:56 2007
@@ -86,6 +86,13 @@
 		return TCP_ERROR_FATAL;
 	}
 
+#if defined SO_RCVTIMEO && defined SO_SNDTIMEO
+	tv.tv_sec = 10;
+	tv.tv_usec = 0;
+	setsockopt(socket_server_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+	setsockopt(socket_server_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+#endif
+
 	switch (af) {
 		case AF_INET:  our_s_addr = (void *) &server_address.four.sin_addr; break;
 #ifdef HAVE_AF_INET6



More information about the MPlayer-cvslog mailing list