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

Revert [23768] and [23768]. Fix dead lock whenever reading from the network.

parent f9ff5b64
...@@ -256,8 +256,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host, ...@@ -256,8 +256,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
static ssize_t static ssize_t
net_ReadInner (vlc_object_t *restrict p_this, unsigned fdc, const int *fdv, net_ReadInner (vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
const v_socket_t *const *restrict vsv, const v_socket_t *const *restrict vsv,
uint8_t *restrict p_buf, size_t i_buflen, vlc_bool_t waitall, uint8_t *restrict p_buf, size_t i_buflen, vlc_bool_t waitall)
int timeout)
{ {
size_t i_total = 0; size_t i_total = 0;
...@@ -282,13 +281,12 @@ net_ReadInner (vlc_object_t *restrict p_this, unsigned fdc, const int *fdv, ...@@ -282,13 +281,12 @@ net_ReadInner (vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
ufd[i].revents = 0; ufd[i].revents = 0;
} }
switch (poll (ufd, fdc, timeout ? timeout : 500)) switch (poll (ufd, fdc, 500))
{ {
case -1: case -1:
goto error; goto error;
case 0: // timeout case 0: // timeout
if( timeout ) return i_total;
continue; continue;
} }
...@@ -401,7 +399,7 @@ ssize_t __net_Read( vlc_object_t *restrict p_this, int fd, ...@@ -401,7 +399,7 @@ ssize_t __net_Read( vlc_object_t *restrict p_this, int fd,
{ {
return net_ReadInner( p_this, 1, &(int){ fd }, return net_ReadInner( p_this, 1, &(int){ fd },
&(const v_socket_t *){ p_vs }, &(const v_socket_t *){ p_vs },
buf, len, b_retry, 0 ); buf, len, b_retry );
} }
...@@ -409,19 +407,16 @@ ssize_t __net_Read( vlc_object_t *restrict p_this, int fd, ...@@ -409,19 +407,16 @@ ssize_t __net_Read( vlc_object_t *restrict p_this, int fd,
* __net_Select: * __net_Select:
***************************************************************************** *****************************************************************************
* Read from several sockets. Takes data from the first socket that has some. * Read from several sockets. Takes data from the first socket that has some.
* if timeout is zero, net_Select will wait indefinitely. timeout is in
* millisecond.
*****************************************************************************/ *****************************************************************************/
ssize_t __net_Select( vlc_object_t *restrict p_this, ssize_t __net_Select( vlc_object_t *restrict p_this,
const int *restrict fds, int nfd, const int *restrict fds, int nfd,
uint8_t *restrict buf, size_t len, uint8_t *restrict buf, size_t len )
int timeout )
{ {
const v_socket_t *vsv[nfd]; const v_socket_t *vsv[nfd];
memset( vsv, 0, sizeof (vsv) ); memset( vsv, 0, sizeof (vsv) );
return net_ReadInner( p_this, nfd, fds, vsv, return net_ReadInner( p_this, nfd, fds, vsv,
buf, len, VLC_FALSE, timeout ); buf, len, VLC_FALSE );
} }
......
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