[glib-networking] Revert "Hold op_mutex during base_check"



commit dd895817f3c821140e45ea12e57386cfb917aeb5
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Sep 4 14:18:05 2020 -0500

    Revert "Hold op_mutex during base_check"
    
    This reverts commit 629a14a438f91ad12991b30674e2aece9c2189c1.

 tls/base/gtlsconnection-base.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index d77cdf51..1d362fed 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -902,15 +902,10 @@ g_tls_connection_base_check (GTlsConnectionBase  *tls,
                              GIOCondition         condition)
 {
   GTlsConnectionBasePrivate *priv = g_tls_connection_base_get_instance_private (tls);
-  gboolean ret = FALSE;
-
-  g_mutex_lock (&priv->op_mutex);
 
+  /* Racy, but worst case is that we just get WOULD_BLOCK back */
   if (priv->need_finish_handshake)
-    {
-      ret = TRUE;
-      goto out;
-    }
+    return TRUE;
 
   /* If op or close is in progress, then tls_istream and tls_ostream are
    * blocked, regardless of the base stream status. Note this also
@@ -918,14 +913,10 @@ g_tls_connection_base_check (GTlsConnectionBase  *tls,
    */
   if (((condition & G_IO_IN) && (priv->reading || priv->read_closing)) ||
       ((condition & G_IO_OUT) && (priv->writing || priv->write_closing)))
-    goto out;
+    return FALSE;
 
   /* Defer to the base stream or GDatagramBased. */
-  ret = g_tls_connection_base_base_check (tls, condition);
-
-out:
-  g_mutex_unlock (&priv->op_mutex);
-  return ret;
+  return g_tls_connection_base_base_check (tls, condition);
 }
 
 typedef struct {


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