[FFmpeg-devel] [PATCH] lavf/tls_gnutls: retry gnutls_handshake on non fatal errors

amine remita remitamine at gmail.com
Thu Mar 28 02:29:15 EET 2019


this patch is based on the documentation for gnutls_handshake
<https://gnutls.org/manual/html_node/TLS-handshake.html>:

> On these non-fatal errors call this function again, until it returns 0
>
and the examples from the gnutls manual, such as:
https://gnutls.org/manual/html_node/Client-with-Resume-capability-example.html
https://gnutls.org/manual/html_node/Simple-client-example-with-X_002e509-certificate-support.html
https://gnutls.org/manual/html_node/Datagram-TLS-client-example.html

On Thu, Mar 28, 2019 at 12:51 AM Michael Niedermayer <michael at niedermayer.cc>
wrote:

> On Wed, Mar 27, 2019 at 01:03:07PM +0100, Remita Amine wrote:
> > fixes #7801
> >
> > Signed-off-by: Remita Amine <remitamine at gmail.com>
> > ---
> >  libavformat/tls_gnutls.c | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
> > index e3c43683be..f32bc2821b 100644
> > --- a/libavformat/tls_gnutls.c
> > +++ b/libavformat/tls_gnutls.c
> > @@ -182,11 +182,13 @@ static int tls_open(URLContext *h, const char
> *uri, int flags, AVDictionary **op
> >      gnutls_transport_set_push_function(p->session, gnutls_url_push);
> >      gnutls_transport_set_ptr(p->session, c->tcp);
> >      gnutls_priority_set_direct(p->session, "NORMAL", NULL);
> > -    ret = gnutls_handshake(p->session);
> > -    if (ret) {
> > -        ret = print_tls_error(h, ret);
> > -        goto fail;
> > -    }
> > +    do {
> > +        ret = gnutls_handshake(p->session);
> > +        if (gnutls_error_is_fatal(ret)) {
> > +            ret = print_tls_error(h, ret);
> > +            goto fail;
> > +        }
> > +    } while (ret);
>
> is retrying the correct action for every non fatal error ?
> is there a maximum retry count ? if not this could potentially
> loop forever
>
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Old school: Use the lowest level language in which you can solve the
> problem
>             conveniently.
> New school: Use the highest level language in which the latest
> supercomputer
>             can solve the problem without the user falling asleep waiting.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list