summaryrefslogtreecommitdiff
path: root/tests/resume.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-12-29 16:53:34 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-12-29 17:14:18 +0100
commit1b12ff5d1c8277880c57eca682afe13115cee627 (patch)
treeff89058652c628fdcabd0e498d2abf3544f7ac17 /tests/resume.c
parentc39587f10121bb9150c0f0221f61405f47334680 (diff)
downloadgnutls-1b12ff5d1c8277880c57eca682afe13115cee627.tar.gz
resume tests will not block if they fail
Diffstat (limited to 'tests/resume.c')
-rw-r--r--tests/resume.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/resume.c b/tests/resume.c
index f23d08d513..c238a8667e 100644
--- a/tests/resume.c
+++ b/tests/resume.c
@@ -143,7 +143,10 @@ static void client(int sds[], struct params_res *params)
/* Perform the TLS handshake
*/
- ret = gnutls_handshake(session);
+ gnutls_handshake_set_timeout(session, 20 * 1000);
+ do {
+ ret = gnutls_handshake(session);
+ } while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fail("client: Handshake failed\n");
@@ -323,10 +326,14 @@ static void server(int sds[], struct params_res *params)
session = initialize_tls_session(params);
gnutls_transport_set_int(session, sd);
- ret = gnutls_handshake(session);
+ gnutls_handshake_set_timeout(session, 20 * 1000);
+ do {
+ ret = gnutls_handshake(session);
+ } while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
close(sd);
gnutls_deinit(session);
+ kill(child, SIGTERM);
fail("server: Handshake has failed (%s)\n\n",
gnutls_strerror(ret));
return;
@@ -347,6 +354,7 @@ static void server(int sds[], struct params_res *params)
("server: Peer has closed the GnuTLS connection\n");
break;
} else if (ret < 0) {
+ kill(child, SIGTERM);
fail("server: Received corrupted data(%d). Closing...\n", ret);
break;
} else if (ret > 0) {