Commit e5ca059b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Simplify EOF handling

parent 8c1e99ea
...@@ -134,9 +134,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv, ...@@ -134,9 +134,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
int wait_ms, vlc_bool_t waitall ) int wait_ms, vlc_bool_t waitall )
{ {
size_t i_total = 0; size_t i_total = 0;
int eof[fdc];
unsigned int i_eof = 0;
memset( eof, 0, sizeof( eof ) );
do do
{ {
...@@ -152,9 +149,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv, ...@@ -152,9 +149,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
if( i_buflen == 0 ) if( i_buflen == 0 )
return i_total; // output buffer full return i_total; // output buffer full
if( i_eof == fdc )
return i_total; // all sockets are at EOF
delay_ms = 500; delay_ms = 500;
if( (wait_ms != -1) && (wait_ms < 500) ) if( (wait_ms != -1) && (wait_ms < 500) )
delay_ms = wait_ms; delay_ms = wait_ms;
...@@ -271,18 +265,13 @@ receive: ...@@ -271,18 +265,13 @@ receive:
goto error; goto error;
} }
if (n == 0) // EOF
return i_total;
i_total += n; i_total += n;
p_buf += n; p_buf += n;
i_buflen -= 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( wait_ms == -1 )
{ {
if( !waitall ) 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