diff options
Diffstat (limited to 'gio/gtlsbackend.c')
-rw-r--r-- | gio/gtlsbackend.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/gio/gtlsbackend.c b/gio/gtlsbackend.c index a78d84be7..80af6ad49 100644 --- a/gio/gtlsbackend.c +++ b/gio/gtlsbackend.c @@ -143,10 +143,8 @@ g_tls_backend_supports_dtls (GTlsBackend *backend) { if (G_TLS_BACKEND_GET_INTERFACE (backend)->supports_dtls) return G_TLS_BACKEND_GET_INTERFACE (backend)->supports_dtls (backend); - else if (G_IS_DUMMY_TLS_BACKEND (backend)) - return FALSE; - else - return TRUE; + + return FALSE; } /** @@ -230,14 +228,22 @@ g_tls_backend_get_server_connection_type (GTlsBackend *backend) * Gets the #GType of @backend’s #GDtlsClientConnection implementation. * * Returns: the #GType of @backend’s #GDtlsClientConnection - * implementation. + * implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS. * * Since: 2.48 */ GType g_tls_backend_get_dtls_client_connection_type (GTlsBackend *backend) { - return G_TLS_BACKEND_GET_INTERFACE (backend)->get_dtls_client_connection_type (); + GTlsBackendInterface *iface; + + g_return_val_if_fail (G_IS_TLS_BACKEND (backend), G_TYPE_INVALID); + + iface = G_TLS_BACKEND_GET_INTERFACE (backend); + if (iface->get_dtls_client_connection_type == NULL) + return G_TYPE_INVALID; + + return iface->get_dtls_client_connection_type (); } /** @@ -247,14 +253,22 @@ g_tls_backend_get_dtls_client_connection_type (GTlsBackend *backend) * Gets the #GType of @backend’s #GDtlsServerConnection implementation. * * Returns: the #GType of @backend’s #GDtlsServerConnection - * implementation. + * implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS. * * Since: 2.48 */ GType g_tls_backend_get_dtls_server_connection_type (GTlsBackend *backend) { - return G_TLS_BACKEND_GET_INTERFACE (backend)->get_dtls_server_connection_type (); + GTlsBackendInterface *iface; + + g_return_val_if_fail (G_IS_TLS_BACKEND (backend), G_TYPE_INVALID); + + iface = G_TLS_BACKEND_GET_INTERFACE (backend); + if (iface->get_dtls_server_connection_type == NULL) + return G_TYPE_INVALID; + + return iface->get_dtls_server_connection_type (); } /** |