From: Nikos Mavrogiannopoulos Date: Sat, 26 Oct 2013 16:38:10 +0000 (+0200) Subject: Added a proper termination of session to avoid issues with premature termination. X-Git-Tag: gnutls_3_2_6~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77f6e4543ee096e3eb87bae4f078b970da674e02;p=thirdparty%2Fgnutls.git Added a proper termination of session to avoid issues with premature termination. --- diff --git a/tests/mini-handshake-timeout.c b/tests/mini-handshake-timeout.c index df0a7f061d..5fea3aee5a 100644 --- a/tests/mini-handshake-timeout.c +++ b/tests/mini-handshake-timeout.c @@ -106,7 +106,7 @@ client (int fd, int wait) ret = gnutls_handshake (session); } while (ret < 0 && gnutls_error_is_fatal(ret) == 0); - + gnutls_deinit(session); gnutls_anon_free_client_credentials(anoncred); gnutls_global_deinit(); @@ -123,6 +123,8 @@ client (int fd, int wait) } else { + gnutls_bye(session, GNUTLS_SHUT_WR); + if (wait != 0) { fail ("client: handshake was completed unexpectedly\n"); @@ -170,11 +172,17 @@ gnutls_anon_server_credentials_t anoncred; gnutls_transport_set_int (session, fd); if (wait) sleep(25); - else do + else { - ret = gnutls_handshake (session); + do + { + ret = gnutls_handshake (session); + } + while (ret < 0 && gnutls_error_is_fatal(ret) == 0); + + if (ret == 0) + gnutls_bye(session, GNUTLS_SHUT_RDWR); } - while (ret < 0 && gnutls_error_is_fatal(ret) == 0); gnutls_deinit (session); gnutls_anon_free_server_credentials(anoncred);