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



commit 3009935bc8779a96ceaca86330f2e4b60318289c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Nov 29 20:00:15 2019 +0000

    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
    
    
    (cherry picked from commit 7303938a265dfc19f99cf7c2c9c5cb5f5210c8bb)

 tls/base/gtlsconnection-base.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 8bd1a43..a85c2aa 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -1454,10 +1454,16 @@ crank_sync_handshake_context (GTlsConnectionBase *tls,
   /* 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]