[glib-networking/wip/pwithnall/dtls] gnutls: Fix DTLS handshaking when packets are lost
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/pwithnall/dtls] gnutls: Fix DTLS handshaking when packets are lost
- Date: Mon, 11 Jan 2016 17:12:47 +0000 (UTC)
commit 350290db270e7a55a18c7694f961ca765f7ebe51
Author: Olivier CrĂȘte <olivier crete collabora com>
Date: Wed Jan 6 21:58:41 2016 -0500
gnutls: Fix DTLS handshaking when packets are lost
During a handshake, the timeout is set to "-1", so blocking forever,
this is wrong for DTLS, where the blocking should instead happen inside
the pull_timeout function. Also, return EAGAIN during the handshake so
that GnuTLS will do the re-tries for us internally and the re-sending as
required.
https://bugzilla.gnome.org/show_bug.cgi?id=697908
tls/gnutls/gtlsconnection-gnutls.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index ebd170e..82180b8 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -1362,7 +1362,13 @@ set_gnutls_error (GTlsConnectionGnutls *gnutls,
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
gnutls_transport_set_errno (gnutls->priv->session, EINTR);
else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
- gnutls_transport_set_errno (gnutls->priv->session, EINTR);
+ {
+ if (gnutls->priv->base_socket &&
+ gnutls->priv->handshaking)
+ gnutls_transport_set_errno (gnutls->priv->session, EAGAIN);
+ else
+ gnutls_transport_set_errno (gnutls->priv->session, EINTR);
+ }
else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT))
gnutls_transport_set_errno (gnutls->priv->session, EINTR);
else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_MESSAGE_TOO_LARGE))
@@ -1394,6 +1400,7 @@ g_tls_connection_gnutls_pull_func (gnutls_transport_ptr_t transport_data,
ret = g_datagram_based_receive_messages (gnutls->priv->base_socket,
&message, 1, 0,
+ gnutls->priv->handshaking ? 0 :
gnutls->priv->read_timeout,
gnutls->priv->read_cancellable,
&gnutls->priv->read_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]