[glib-networking/wip/pwithnall/dtls: 12/12] gnutls: WIP work to potentially fix deadlocks in implicit handshaking?



commit 30b703154cfcc111b6c1bdb5baac6837551a6143
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Jan 18 18:07:52 2016 +0000

    gnutls: WIP work to potentially fix deadlocks in implicit handshaking?
    
    when running the per-operation timeout tests

 tls/gnutls/gtlsconnection-gnutls.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 1323f76..73f05d3 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -2027,8 +2027,7 @@ do_implicit_handshake (GTlsConnectionGnutls  *gnutls,
 
   begin_handshake (gnutls);
 
-  /* FIXME: Support (timeout > 0). */
-  if (timeout != 0)
+  if (timeout < 0)
     {
       GError *my_error = NULL;
       gboolean success;
@@ -2052,8 +2051,12 @@ do_implicit_handshake (GTlsConnectionGnutls  *gnutls,
       g_task_run_in_thread (gnutls->priv->implicit_handshake,
                            async_handshake_thread);
 
-      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,
-                          _("Operation would block"));
+      if (timeout == 0)
+        g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,
+                             _("Operation would block"));
+      else
+        g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
+                             _("Socket I/O timed out"));
 
       return FALSE;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]