[glib-networking/mcatanzaro/glib-#2393] tls: implement get_negotiated_protocol vfunc
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/mcatanzaro/glib-#2393] tls: implement get_negotiated_protocol vfunc
- Date: Thu, 29 Apr 2021 19:03:43 +0000 (UTC)
commit 84899b10de811aceadfa20c8ce66f726d535aa73
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Thu Apr 29 13:59:03 2021 -0500
tls: implement get_negotiated_protocol vfunc
This allows GLib to remove some API-level caching that is not
threadsafe.
Because this bumps GLIB_VERSION_MIN_REQUIRED, we need to ignore deprecations for
for GTlsRehandshakeMode.
Fixes glib#2393
meson.build | 4 ++--
tls/base/gtlsconnection-base.c | 36 +++++++++++++++++++++++-------------
2 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/meson.build b/meson.build
index 768cdf2..41e6366 100644
--- a/meson.build
+++ b/meson.build
@@ -29,7 +29,7 @@ common_flags = [
'-DG_LOG_USE_STRUCTURED',
'-DLOCALE_DIR="@0@"'.format(localedir),
'-DG_DISABLE_DEPRECATED',
- '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56'
+ '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_70'
]
add_project_arguments(common_flags, language: 'c')
@@ -48,7 +48,7 @@ if host_system.contains('linux')
endif
# *** Check GLib GIO ***
-glib_dep = dependency('glib-2.0', version: '>= 2.67.0',
+glib_dep = dependency('glib-2.0', version: '>= 2.69.0',
fallback: ['glib', 'libglib_dep'])
gio_dep = dependency('gio-2.0',
fallback: ['glib', 'libgio_dep'])
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 294728f..4e5aa22 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -99,7 +99,10 @@ typedef struct
gboolean peer_certificate_examined;
gboolean require_close_notify;
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GTlsRehandshakeMode rehandshake_mode;
+G_GNUC_END_IGNORE_DEPRECATIONS
/* need_handshake means the next claim_op() will get diverted into
* an implicit handshake (unless it's an OP_HANDSHAKE or OP_CLOSE*).
@@ -1447,6 +1450,21 @@ g_tls_connection_base_dtls_get_binding_data (GDtlsConnection *conn,
type, data, error);
}
+static const gchar *
+g_tls_connection_base_get_negotiated_protocol (GTlsConnection *conn)
+{
+ GTlsConnectionBase *tls = G_TLS_CONNECTION_BASE (conn);
+ GTlsConnectionBasePrivate *priv = g_tls_connection_base_get_instance_private (tls);
+
+ return priv->negotiated_protocol;
+}
+
+static const gchar *
+g_tls_connection_base_dtls_get_negotiated_protocol (GDtlsConnection *conn)
+{
+ return g_tls_connection_base_get_negotiated_protocol (G_TLS_CONNECTION (conn));
+}
+
static void
handshake_thread (GTask *task,
gpointer object,
@@ -2542,15 +2560,6 @@ g_tls_connection_base_dtls_set_advertised_protocols (GDtlsConnection *conn,
g_object_set (conn, "advertised-protocols", protocols, NULL);
}
-const gchar *
-g_tls_connection_base_dtls_get_negotiated_protocol (GDtlsConnection *conn)
-{
- GTlsConnectionBase *tls = G_TLS_CONNECTION_BASE (conn);
- GTlsConnectionBasePrivate *priv = g_tls_connection_base_get_instance_private (tls);
-
- return priv->negotiated_protocol;
-}
-
GDatagramBased *
g_tls_connection_base_get_base_socket (GTlsConnectionBase *tls)
{
@@ -2711,10 +2720,11 @@ g_tls_connection_base_class_init (GTlsConnectionBaseClass *klass)
gobject_class->set_property = g_tls_connection_base_set_property;
gobject_class->finalize = g_tls_connection_base_finalize;
- connection_class->handshake = g_tls_connection_base_handshake;
- connection_class->handshake_async = g_tls_connection_base_handshake_async;
- connection_class->handshake_finish = g_tls_connection_base_handshake_finish;
- connection_class->get_binding_data = g_tls_connection_base_get_binding_data;
+ connection_class->handshake = g_tls_connection_base_handshake;
+ connection_class->handshake_async = g_tls_connection_base_handshake_async;
+ connection_class->handshake_finish = g_tls_connection_base_handshake_finish;
+ connection_class->get_binding_data = g_tls_connection_base_get_binding_data;
+ connection_class->get_negotiated_protocol = g_tls_connection_base_get_negotiated_protocol;
iostream_class->get_input_stream = g_tls_connection_base_get_input_stream;
iostream_class->get_output_stream = g_tls_connection_base_get_output_stream;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]