Commit 54ba7c42 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fix hang in live555 when sending RTSP OPTIONS by letting readSocket() timeout...

Fix hang in live555 when sending RTSP OPTIONS by letting readSocket() timeout after 5 seconds. Added reconnect case to modules/demux/live555.cpp (without backing off scenario).
parent ab7704a5
...@@ -114,3 +114,26 @@ diff -ru live/groupsock/NetInterface.cpp live-patched/groupsock/NetInterface.cpp ...@@ -114,3 +114,26 @@ diff -ru live/groupsock/NetInterface.cpp live-patched/groupsock/NetInterface.cpp
} }
Boolean RTSPClient::parseGetParameterHeader(char const* line, Boolean RTSPClient::parseGetParameterHeader(char const* line,
--- live/liveMedia/RTSPClient.cpp 2007-04-28 16:02:39.000000000 +0200
+++ live-patched/liveMedia/RTSPClient.cpp 2007-12-10 10:42:00.000000000 +0100
@@ -2074,7 +2076,8 @@ Boolean RTSPClient::getResponse(char con
unsigned RTSPClient::getResponse1(char*& responseBuffer,
unsigned responseBufferSize) {
struct sockaddr_in fromAddress;
-
+ struct timeval timeout;
+
if (responseBufferSize == 0) return 0; // just in case...
responseBuffer[0] = '\0'; // ditto
@@ -2084,7 +2087,9 @@ unsigned RTSPClient::getResponse1(char*&
Boolean success = False;
while (1) {
unsigned char firstByte;
- if (readSocket(envir(), fInputSocketNum, &firstByte, 1, fromAddress)
+ timeout.tv_sec = 5;
+ timeout.tv_usec = 0;
+ if (readSocket(envir(), fInputSocketNum, &firstByte, 1, fromAddress, &timeout)
!= 1) break;
if (firstByte != '$') {
// Normal case: This is the start of a regular response; use it:
...@@ -552,6 +552,12 @@ describe: ...@@ -552,6 +552,12 @@ describe:
if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp ); if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp );
goto createnew; goto createnew;
} }
else
{
msg_Info( p_demux, "connection timeout, retrying" );
if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp );
goto createnew;
}
i_ret = VLC_EGENERIC; i_ret = VLC_EGENERIC;
} }
if( psz_url ) free( psz_url ); if( psz_url ) free( psz_url );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment