[vlc-devel] [PATCH] gnutls: retry handshake if it returns a non-fatal error

Ludovic Fauvet etix at videolan.org
Thu Feb 7 17:20:16 CET 2013


On Thu, Feb 7, 2013 at 5:10 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> On Thu, 07 Feb 2013 16:57:40 +0100, Rafaël Carré <funman at videolan.org>
> wrote:
>>>> But we already return when meeting those non-fatal errrors.
>>>
>>> There are other non-fatals errors that are not those 2.
>>
>> Hm ok it looks good then.
>>
>> The manual is confusing (why put these 2 on the same line?)
>
> To be blunt, it's not just the manual. The loop structure is also very
> confusing as proposed in this patch.
>
> This would be a lot more readable IMHO:
>
>     do
>     {
>         val = gnutls_handshake (sys->session);
>         msg_Dbg (session, "TLS handshake: %s", gnutls_strerror (val));
>
>         if ((val == GNUTLS_E_AGAIN) || (val == GNUTLS_E_INTERRUPTED))
>             /* I/O event: return to caller's poll() loop */
>             return 1 + gnutls_record_get_direction (sys->session);
>     }
>     while (val < 0 && !gnutls_error_is_fatal (val));

At first I thought printing all messages was a bit overkill but since
you suggested it...

-- 
Ludovic Fauvet



More information about the vlc-devel mailing list