[vlc-devel] [PATCH] core: network: recover from reading on invalid sockets
Rémi Denis-Courmont
remi at remlab.net
Tue Jan 15 15:38:45 CET 2019
Hi,
This statistical approach oooks like it can lead to spurious failures, on all platforms. No way.
The bug must be somewhere else.
Le 15 janvier 2019 13:52:12 GMT+02:00, Xie Zhigang <zighouse at hotmail.com> a écrit :
>Fix the bug on Windows: if pausing the on-line VOD playing
>for a long time (5 minutes or so), and the remote VOD server drops the
>tcp connection, vlc_tls_Read() will be in an endless loop of retrial
>with errno as EAGAIN. Use a max retrial count to recover vlc from the
>endless reading loop.
>---
> src/network/stream.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/src/network/stream.c b/src/network/stream.c
>index 6e015d5..7324f78 100644
>--- a/src/network/stream.c
>+++ b/src/network/stream.c
>@@ -55,6 +55,7 @@ ssize_t vlc_tls_Read(vlc_tls_t *session, void *buf,
>size_t len, bool waitall)
> {
> struct pollfd ufd;
> struct iovec iov;
>+ int turn = 0;
>
> ufd.events = POLLIN;
> ufd.fd = vlc_tls_GetPollFD(session, &ufd.events);
>@@ -89,6 +90,12 @@ ssize_t vlc_tls_Read(vlc_tls_t *session, void *buf,
>size_t len, bool waitall)
> }
>
> vlc_poll_i11e(&ufd, 1, -1);
>+ /*
>+ * Use an arbitrary max retrial count (10) to recover from
>endless loop
>+ * on an invalid connection.
>+ */
>+ if (++turn > 10)
>+ return rcvd ? (ssize_t)rcvd : -1;
> }
> }
>
>--
>2.7.4
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190115/8c1e797d/attachment.html>
More information about the vlc-devel
mailing list