Commit 64fea282 authored by Clément Stenac's avatar Clément Stenac

Even if we are asked to wait for data, bail out if all sockets are at EOF.

I'm far from being sure this is the right thing to do, but it allows MMSH to work correctly (it requests some data while the server is closing connection)
parent f424ec54
......@@ -144,6 +144,9 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
int wait_ms, vlc_bool_t waitall )
{
size_t i_total = 0;
int eof[fdc];
unsigned int i_eof = 0;
memset( eof, 0, sizeof( eof ) );
do
{
......@@ -159,6 +162,9 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
if( i_buflen == 0 )
return i_total; // output buffer full
if( i_eof == fdc )
return i_total; // all sockets are at EOF
delay_ms = 500;
if( (wait_ms != -1) && (wait_ms < 500) )
delay_ms = wait_ms;
......@@ -276,6 +282,14 @@ receive:
p_buf += n;
i_buflen -= n;
if( n == 0 ) // EOF on socket
{
unsigned int j;
for( j = 0 ; j < i_eof ; j++ )
if( eof[j] == *fdv ) goto end;
eof[i_eof++] = *fdv;
}
end:
if( wait_ms == -1 )
{
if( !waitall )
......
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