[vlc-commits] tls: fix ignored interrupts

Thomas Guillem git at videolan.org
Wed Oct 11 09:42:45 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Oct 10 12:58:52 2017 +0200| [51b96bb9c48f947b3c12af514cd79d5864881138] | committer: Thomas Guillem

tls: fix ignored interrupts

If session->readv() or session->writev() are interrupted, the next call to
vlc_poll_i11e() will hang since the interrupt context is already finished (by
readv/writev).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=51b96bb9c48f947b3c12af514cd79d5864881138
---

 src/network/tls.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/network/tls.c b/src/network/tls.c
index 4ebcfb319c..1fae1d0e0f 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -253,8 +253,13 @@ ssize_t vlc_tls_Read(vlc_tls_t *session, void *buf, size_t len, bool waitall)
         }
         if (iov.iov_len == 0 || val == 0)
             return rcvd;
-        if (val == -1 && errno != EINTR && errno != EAGAIN)
-            return rcvd ? (ssize_t)rcvd : -1;
+        if (val == -1)
+        {
+            if (vlc_killed())
+                return -1;
+            if (errno != EINTR && errno != EAGAIN)
+                return rcvd ? (ssize_t)rcvd : -1;
+        }
 
         vlc_poll_i11e(&ufd, 1, -1);
     }
@@ -287,8 +292,13 @@ ssize_t vlc_tls_Write(vlc_tls_t *session, const void *buf, size_t len)
         }
         if (iov.iov_len == 0 || val == 0)
             return sent;
-        if (val == -1 && errno != EINTR && errno != EAGAIN)
-            return sent ? (ssize_t)sent : -1;
+        if (val == -1)
+        {
+            if (vlc_killed())
+                return -1;
+            if (errno != EINTR && errno != EAGAIN)
+                return sent ? (ssize_t)sent : -1;
+        }
 
         vlc_poll_i11e(&ufd, 1, -1);
     }



More information about the vlc-commits mailing list