Commit ca82afbf authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by Jean-Baptiste Kempf

gnutls: retry handshake if it returns a non-fatal error

Based on the gnutls_handshake manual the function must be called again
until it returns 0 (or a fatal error).
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent c1ec4dee
......@@ -229,9 +229,16 @@ static int gnutls_ContinueHandshake (vlc_tls_t *session, const char *host,
#ifdef WIN32
WSASetLastError (0);
#endif
val = gnutls_handshake (sys->session);
if ((val == GNUTLS_E_AGAIN) || (val == GNUTLS_E_INTERRUPTED))
return 1 + gnutls_record_get_direction (sys->session);
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));
if (val < 0)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment