[vlc-devel] [PATCH] core: network: recover from reading on invalid sockets

jeremy.vignelles at dev3i.fr jeremy.vignelles at dev3i.fr
Tue Jan 15 16:37:47 CET 2019


Hi,
Is this patch related to https://trac.videolan.org/vlc/ticket/21153 ?

This does not look like a proper fix for me either.

Regards,
Jérémy VIGNELLES

De : vlc-devel <vlc-devel-bounces at videolan.org> De la part de Rémi Denis-Courmont
Envoyé : mardi 15 janvier 2019 15:39
À : Mailing list for VLC media player developers <vlc-devel at videolan.org>
Objet : Re: [vlc-devel] [PATCH] core: network: recover from reading on invalid sockets

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 <mailto: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;
     }
 }
 

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.



More information about the vlc-devel mailing list