- return i_recv ? i_recv : -1; /* !i_recv -> connection closed if tcp */
- }
-
- /* We will never be here */
- return -1;
-}
-
-/*****************************************************************************
- * __net_Select:
- *****************************************************************************
- * Read from several sockets (with timeout). Takes data from the first socket
- * that has some.
- *****************************************************************************/
-int __net_Select( vlc_object_t *p_this, int *pi_fd, v_socket_t **pp_vs,
- int i_fd, uint8_t *p_data, int i_data, mtime_t i_wait )
-{
- struct timeval timeout;
- fd_set fds_r, fds_e;
- int i_recv;
- int i_ret;
- int i;
- int i_max_fd = 0;
-
- /* Initialize file descriptor set */
- FD_ZERO( &fds_r );
- FD_ZERO( &fds_e );
-
- for( i = 0 ; i < i_fd ; i++)
- {
- if( pi_fd[i] > i_max_fd ) i_max_fd = pi_fd[i];
- FD_SET( pi_fd[i], &fds_r );
- FD_SET( pi_fd[i], &fds_e );
- }
-
- timeout.tv_sec = 0;
- timeout.tv_usec = i_wait;
-
- i_ret = select( i_max_fd + 1, &fds_r, NULL, &fds_e, &timeout );