diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-09-20 23:36:00 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-09-20 23:37:13 +0200 |
commit | 2b997db624a800b6d74bdd9ccbf46cc362495d84 (patch) | |
tree | 36f4e9c64007ea80e7d659bf320ea01d60ca9a88 /src/common.c | |
parent | 46e2ec85cfeafa9a85093d3ce35ccf720e8a9195 (diff) | |
download | gnutls-2b997db624a800b6d74bdd9ccbf46cc362495d84.tar.gz |
updates in heartbeat support
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c index 4b21e22c7a..2bccedc8c6 100644 --- a/src/common.c +++ b/src/common.c @@ -1042,6 +1042,8 @@ print_list (const char *priorities, int verbose) int check_command(gnutls_session_t session, const char* str) { size_t len = strnlen(str, 128); + int ret; + fprintf (stderr, "*** Processing %zu bytes command: %s\n", len, str); if (len > 2 && str[0] == str[1] && str[0] == '*') { @@ -1051,7 +1053,19 @@ int check_command(gnutls_session_t session, const char* str) gnutls_rehandshake (session); return 1; } else if (strncmp(str, "**HEARTBEAT**", sizeof ("**HEARTBEAT**") - 1) == 0) { - gnutls_heartbeat_ping_rnd (session); + ret = gnutls_heartbeat_ping (session, 300, 5, GNUTLS_HEARTBEAT_WAIT); + if (ret < 0) + { + if (ret == GNUTLS_E_INVALID_REQUEST) + { + fprintf(stderr, "No heartbeat in this session\n"); + } + else + { + fprintf(stderr, "ping: %s\n", gnutls_strerror(ret)); + exit(1); + } + } return 2; } } |