summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-01-26 14:24:22 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-09-01 13:24:08 -0500
commit4a1aeda4d8dff96a8a9037d4639aa7b96c87f927 (patch)
tree2453fb36c051eebac91b7195ae4547e06a284868
parent30d676659c590d8ec6eb198ddd34777d581b9ceb (diff)
downloadglib-networking-4a1aeda4d8dff96a8a9037d4639aa7b96c87f927.tar.gz
Account for ongoing ops in check function
If we have a conflicting op in progress, then we are not ready to read or write.
-rw-r--r--tls/base/gtlsconnection-base.c12
1 files 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. */