[vlc-devel] [PATCH] tls: fix ignored interrupts
Rémi Denis-Courmont
remi at remlab.net
Tue Oct 10 12:54:58 CEST 2017
Le 10 octobre 2017 13:50:40 GMT+03:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>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).
>---
> 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..f07d0d6f9f 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 (errno == EINTR)
>+ return -1;
>+ else if (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 (errno == EINTR)
>+ return -1;
>+ else if (errno != EAGAIN)
>+ return sent ? (ssize_t)sent : -1;
>+ }
>
> vlc_poll_i11e(&ufd, 1, -1);
> }
>--
>2.11.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
It looks to me that this breaks signal handling on the one hand, and I don't understand what it fixes on the other.
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
More information about the vlc-devel
mailing list