# HG changeset patch # User bertrand # Date 1024643206 0 # Node ID 08712c93b64371d3755563ff1d6c84beb5c711f2 # Parent a48a7315ed885f0170386b2f871b198c0102a9f4 Here I go again, another fix for the timeout. Note that we shouldn't rely on the value of the timeval struct after select returns. diff -r a48a7315ed88 -r 08712c93b643 libmpdemux/network.c --- a/libmpdemux/network.c Fri Jun 21 06:28:24 2002 +0000 +++ b/libmpdemux/network.c Fri Jun 21 07:06:46 2002 +0000 @@ -168,16 +168,16 @@ return -1; } } - tv.tv_sec = 5; - tv.tv_usec = 0; + tv.tv_sec = 0; + tv.tv_usec = 500000; FD_ZERO( &set ); FD_SET( socket_server_fd, &set ); // When the connection will be made, we will have a writable fd while((ret = select(socket_server_fd+1, NULL, &set, NULL, &tv)) == 0) { if( ret<0 ) mp_msg(MSGT_NETWORK,MSGL_ERR,"select failed\n"); else if(ret > 0) break; - else if(count > 15 || mpdemux_check_interrupt(500)) { - if(count > 15) + else if(count > 30 || mpdemux_check_interrupt(500)) { + if(count > 30) mp_msg(MSGT_NETWORK,MSGL_ERR,"Connection timeout\n"); else mp_msg(MSGT_NETWORK,MSGL_V,"Connection interuppted by user\n"); @@ -186,6 +186,8 @@ count++; FD_ZERO( &set ); FD_SET( socket_server_fd, &set ); + tv.tv_sec = 0; + tv.tv_usec = 500000; } // Turn back the socket as blocking