[glib-networking/mcatanzaro/#20: 4/10] Account for ongoing ops in check function




commit b651e0db2cea8dd5109af7f07e32dc4682b5d942
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Jan 26 14:24:22 2020 -0600

    Account for ongoing ops in check function
    
    If we have a conflicting po in progress, then we are not ready to read
    or write.

 tls/base/gtlsconnection-base.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 97ac24f..7001104 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -907,14 +907,12 @@ g_tls_connection_base_check (GTlsConnectionBase  *tls,
   if (priv->need_finish_handshake)
     return TRUE;
 
-  /* If a handshake or close is in progress, then tls_istream and
-   * tls_ostream are blocked, regardless of the base stream status.
+  /* If op or close is in progress, then tls_istream and tls_ostream are
+   * blocked, regardless of the base stream status. Note this also
+   * accounts for handshake ops.
    */
-  if (priv->handshaking)
-    return FALSE;
-
-  if (((condition & G_IO_IN) && priv->read_closing) ||
-      ((condition & G_IO_OUT) && priv->write_closing))
+  if (((condition & G_IO_IN) && (priv->reading || priv->read_closing)) ||
+      ((condition & G_IO_OUT) && (priv->writing || priv->write_closing)))
     return FALSE;
 
   /* Defer to the base stream or GDatagramBased. */


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