[rtmpdump] RTMP socket timeout leads to endless loop
Skaarj NaPali
skaarj1 at gmail.com
Sun Aug 22 12:40:43 CEST 2010
In case there is a RTMP socket timeout error (EWOULDBLOCK) in
"RTMPSockBuf_Fill", the calling functions do not close the socket
because "sb_timedout" was set to TRUE and "RTMP_Read" will indirectly
set the RTMP read state to "RTMP_READ_EOF". Eventually this leads to
an endless loop in the "Download" function of "rtmpdump.c". The reason
for this is because of:
*) "RTMP_IsConnected" keeps returning TRUE because the socket was not closed.
*) "RTMP_Read" keeps returning '0' because the RTMP read state was set
to "RTMP_READ_EOF" (see above).
A quick fix to avoid this worse case scenario is to add at least the
following check within the "while" loop of the "Download" function:
…
if (nRead == 0
&& (rtmp->m_read.status == RTMP_READ_EOF
|| rtmp->m_read.status == RTMP_READ_COMPLETE))
break;
}
while (!RTMP_ctrlC && nRead > -1 && RTMP_IsConnected(rtmp));
…
More information about the rtmpdump
mailing list