[glib-networking/mcatanzaro/tls-thread] progress?
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/mcatanzaro/tls-thread] progress?
- Date: Sun, 11 Aug 2019 21:35:37 +0000 (UTC)
commit aab50efeee195b6a2fd939a255d5c565ade3e17b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Aug 11 13:56:03 2019 -0500
progress?
tls/base/gtlsconnection-base.c | 22 +++++++++++++++++++++-
tls/base/gtlsconnection-base.h | 3 +++
tls/base/gtlsthread.c | 8 ++++----
3 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 66038b6..e4712ba 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -1123,13 +1123,33 @@ g_tls_connection_base_dtls_create_source (GDatagramBased *datagram_based,
static GIOCondition
g_tls_connection_base_condition_check (GDatagramBased *datagram_based,
- GIOCondition condition)
+ GIOCondition condition)
{
GTlsConnectionBase *tls = G_TLS_CONNECTION_BASE (datagram_based);
return g_tls_connection_base_check (tls, condition) ? condition : 0;
}
+/* Returns a GSource for the underlying GDatagramBased or base stream, not for
+ * the GTlsConnectionBase itself.
+ */
+GSource *
+g_tls_connection_base_create_base_source (GTlsConnectionBase *tls,
+ GIOCondition condition,
+ GCancellable *cancellable)
+{
+ GTlsConnectionBasePrivate *priv = g_tls_connection_base_get_instance_private (tls);
+
+ if (g_tls_connection_base_is_dtls (tls))
+ return g_datagram_based_create_source (priv->base_socket, condition, cancellable);
+ if (condition & G_IO_IN)
+ return g_pollable_input_stream_create_source (priv->base_istream, cancellable);
+ if (condition & G_IO_OUT)
+ return g_pollable_output_stream_create_source (priv->base_ostream, cancellable);
+
+ g_assert_not_reached ();
+}
+
static gboolean
g_tls_connection_base_condition_wait (GDatagramBased *datagram_based,
GIOCondition condition,
diff --git a/tls/base/gtlsconnection-base.h b/tls/base/gtlsconnection-base.h
index 1527119..a63e770 100644
--- a/tls/base/gtlsconnection-base.h
+++ b/tls/base/gtlsconnection-base.h
@@ -159,6 +159,9 @@ gboolean g_tls_connection_base_base_check (GTlsCon
GSource *g_tls_connection_base_create_source (GTlsConnectionBase *tls,
GIOCondition condition,
GCancellable *cancellable);
+GSource *g_tls_connection_base_create_base_source (GTlsConnectionBase *tls,
+ GIOCondition condition,
+ GCancellable *cancellable);
gboolean g_tls_connection_base_close_internal (GIOStream *stream,
GTlsDirection direction,
diff --git a/tls/base/gtlsthread.c b/tls/base/gtlsthread.c
index 383fbd4..9eb0deb 100644
--- a/tls/base/gtlsthread.c
+++ b/tls/base/gtlsthread.c
@@ -431,7 +431,7 @@ gint64 original_timeout = delayed_op->timeout;
}
GTLS_OP_DEBUG (op, "%s: delayed_op=%p type=%d, timeout reduced from %ld to %ld", __FUNCTION__, delayed_op,
op->type, original_timeout, op->timeout);
- if (!g_tls_connection_base_check (op->connection, op->condition))
+ if (!g_tls_connection_base_base_check (op->connection, op->condition))
{
/* Not ready for I/O. Either we timed out, or were cancelled, or we
* could have a spurious wakeup caused by GTlsConnectionBase yield_op.
@@ -505,9 +505,9 @@ wait:
GMainContext *main_context;
DelayedOpAsyncData *data;
- tls_source = g_tls_connection_base_create_source (op->connection,
- op->condition,
- op->cancellable);
+ tls_source = g_tls_connection_base_create_base_source (op->connection,
+ op->condition,
+ op->cancellable);
if (op->timeout > 0)
{
op->start_time = g_get_monotonic_time ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]