[glib-networking/glib-2-60] Disable cancellation of sync handshakes



commit 3ad9b1d9ecbc08ef82f08c3f702141068a175cf0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Dec 4 14:09:39 2019 -0600

    Disable cancellation of sync handshakes
    
    I don't know how to make cancellation work unless we guard access to the
    handshake_context using a mutex. The code is too complex already, and I
    don't want to add another mutex. I think this will be a lot easier to
    fix once we have all TLS operations running on one secondary thread.
    
    Hopefully fixes #97

 tls/gnutls/gtlsconnection-gnutls.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 01b388a..7ccab51 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -2216,10 +2216,16 @@ crank_sync_handshake_context (GTlsConnectionGnutls *gnutls,
   /* need_finish_handshake will be set inside sync_handshake_thread_completed(),
    * which should only ever be invoked while iterating the handshake context
    * here. So need_finish_handshake should only change on this thread.
+   *
+   * FIXME: This function is not cancellable. We should figure out how to
+   * support cancellation. We must not return from this function before it is
+   * safe to destroy handshake_context, but it's not safe to destroy
+   * handshake_context until after the handshake has completed. And the
+   * handshake operation is not cancellable, so we have a problem.
    */
   g_mutex_lock (&priv->op_mutex);
   priv->sync_handshake_in_progress = TRUE;
-  while (priv->sync_handshake_in_progress && !g_cancellable_is_cancelled (cancellable))
+  while (priv->sync_handshake_in_progress)
     {
       g_mutex_unlock (&priv->op_mutex);
       g_main_context_iteration (priv->handshake_context, TRUE);


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