diff options
Diffstat (limited to 'lib/gnutls_handshake.h')
-rw-r--r-- | lib/gnutls_handshake.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gnutls_handshake.h b/lib/gnutls_handshake.h index 22a55f7dec..4fa14f3d9c 100644 --- a/lib/gnutls_handshake.h +++ b/lib/gnutls_handshake.h @@ -23,6 +23,8 @@ #ifndef HANDSHAKE_H #define HANDSHAKE_H +#include <gnutls_errors.h> + int _gnutls_send_handshake (gnutls_session_t session, mbuffer_st * bufel, gnutls_handshake_description_t type); int _gnutls_recv_hello_request (gnutls_session_t session, void *data, @@ -55,4 +57,17 @@ void _gnutls_handshake_hash_buffers_clear (gnutls_session_t session); #define AGAIN(target) (STATE==target?1:0) #define AGAIN2(state, target) (state==target?1:0) +inline static int handshake_remaining_time(gnutls_session_t session) +{ + if (session->internals.handshake_endtime) + { + time_t now = gnutls_time(0); + if (now < session->internals.handshake_endtime) + return (session->internals.handshake_endtime - now) * 1000; + else + return gnutls_assert_val(GNUTLS_E_TIMEDOUT); + } + return 0; +} + #endif |