Changeset 64fea282d28f812fef7c5622fca0ed39d70ad136

Show
Ignore:
Timestamp:
16/09/06 13:01:24 (2 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1158404484 +0000
git-parent:

[f424ec54abf8f25e4107a9219390625f0630cde7]

git-author:
Clément Stenac <zorglub@videolan.org> 1158404484 +0000
Message:

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)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/network/io.c

    r83f23b6 r64fea28  
    145145{ 
    146146    size_t i_total = 0; 
     147    int eof[fdc]; 
     148    unsigned int i_eof = 0; 
     149    memset( eof, 0, sizeof( eof ) ); 
    147150 
    148151    do 
     
    159162        if( i_buflen == 0 ) 
    160163            return i_total; // output buffer full 
     164 
     165        if( i_eof == fdc ) 
     166            return i_total; // all sockets are at EOF 
    161167 
    162168        delay_ms = 500; 
     
    277283        i_buflen -= n; 
    278284 
     285        if( n ==  0 ) // EOF on socket 
     286        { 
     287            unsigned int j; 
     288            for( j = 0 ; j < i_eof ; j++ ) 
     289                if( eof[j] == *fdv ) goto end; 
     290            eof[i_eof++] = *fdv; 
     291        } 
     292end: 
    279293        if( wait_ms == -1 ) 
    280294        {