[glib-networking/mcatanzaro/#20] always dispatch
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/mcatanzaro/#20] always dispatch
- Date: Sat, 11 Jan 2020 23:31:47 +0000 (UTC)
commit 78cb81bed690dbf865f550fa4a508e24af62afba
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sat Jan 11 17:31:19 2020 -0600
always dispatch
We are allowed to have false-positives.
We are not allowed to ignore, e.g., g_source_set_ready_time().
tls/base/gtlsconnection-base.c | 35 +++++++++--------------------------
1 file changed, 9 insertions(+), 26 deletions(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 2fad5e6..41e9a6d 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -992,7 +992,7 @@ tls_source_sync (GTlsConnectionBaseSource *tls_source)
G_TLS_CONNECTION_BASE_GET_CLASS (tls)->check &&
G_TLS_CONNECTION_BASE_GET_CLASS (tls)->check (tls, tls_source->condition))
io_waiting = FALSE;
-
+g_info("%s: source=%p op_waiting=%d io_waiting=%d", __FUNCTION__, tls_source, op_waiting, io_waiting);
if (op_waiting == tls_source->op_waiting &&
io_waiting == tls_source->io_waiting)
return;
@@ -1043,35 +1043,18 @@ tls_source_dispatch (GSource *source,
GDatagramBasedSourceFunc datagram_based_func = (GDatagramBasedSourceFunc)callback;
GPollableSourceFunc pollable_func = (GPollableSourceFunc)callback;
GTlsConnectionBaseSource *tls_source = (GTlsConnectionBaseSource *)source;
- GTlsConnectionBase *tls = tls_source->tls;
- GTlsConnectionBasePrivate *priv = g_tls_connection_base_get_instance_private (tls);
- gboolean dispatch;
gboolean ret;
- /* We are *allowed* to have spurious false-positive dispatches when
- * not actually readable/writable, but let's check anyway before
- * dispatching to be nice to applications. We can get here spuriously
- * whenever yield_op cancels waiting_for_op.
- */
- dispatch = g_tls_connection_base_check (tls_source->tls, tls_source->condition);
- if (!dispatch)
- {
- g_mutex_lock (&priv->op_mutex);
- dispatch = priv->need_handshake;
- g_mutex_unlock (&priv->op_mutex);
- }
+ if (G_IS_DATAGRAM_BASED (tls_source->base))
+ ret = (*datagram_based_func) (G_DATAGRAM_BASED (tls_source->base),
+ tls_source->condition, user_data);
+ else
+ ret = (*pollable_func) (tls_source->base, user_data);
- if (dispatch)
- {
- if (G_IS_DATAGRAM_BASED (tls_source->base))
- ret = (*datagram_based_func) (G_DATAGRAM_BASED (tls_source->base),
- tls_source->condition, user_data);
- else
- ret = (*pollable_func) (tls_source->base, user_data);
- return ret;
- }
+ if (ret == G_SOURCE_CONTINUE)
+ tls_source_sync (tls_source);
- return G_SOURCE_CONTINUE;
+ return ret;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]