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

Rémi Denis-Courmont remi at remlab.net
Thu Feb 7 17:10:11 CET 2013


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));


-- 
Rémi Denis-Courmont
Sent from my collocated server




More information about the vlc-devel mailing list