Changeset c4c6895899f54a303fdda41db9300484911ea5fd

Show
Ignore:
Timestamp:
14/08/07 20:53:44 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1187117624 +0000
git-parent:

[3b396a3d5331de10afa57d023afafbc779baeb58]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1187117624 +0000
Message:

select() sucks

Files:

Legend:

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

    rf3743d4 rc4c6895  
    136136            socklen_t i_val_size = sizeof( i_val ); 
    137137            div_t d; 
    138             struct timeval tv; 
    139138            vlc_value_t timeout; 
    140139 
     
    163162            for (;;) 
    164163            { 
    165                 fd_set fds
     164                struct pollfd ufd = { .fd = fd, .events = POLLOUT }
    166165                int i_ret; 
    167166 
     
    175174                } 
    176175 
    177                 /* Initialize file descriptor set */ 
    178                 FD_ZERO( &fds ); 
    179                 FD_SET( fd, &fds ); 
    180  
    181176                /* 
    182177                 * We'll wait 0.1 second if nothing happens 
     
    184179                 * time out will be shortened if we catch a signal (EINTR) 
    185180                 */ 
    186                 tv.tv_sec = 0; 
    187                 tv.tv_usec = (d.quot > 0) ? 100000 : (1000 * d.rem); 
    188  
    189                 i_ret = select( fd + 1, NULL, &fds, NULL, &tv ); 
     181                i_ret = poll (&ufd, 1, (d.quot > 0) ? 100 : d.rem); 
    190182                if( i_ret == 1 ) 
    191183                    break;