[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: Sat, 28 Dec 2019 23:00:06 +0000 (UTC)
commit 950386cb579ea1de092a7343cb31fe2933d08bdb
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sat Dec 28 16:59:52 2019 -0600
progress
tls/base/gtlsconnection-base.c | 26 +++++++++++++-------------
tls/gnutls/gtlsoperationsthread-gnutls.c | 4 +---
2 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 7d58f0b..899eac2 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -770,29 +770,28 @@ static GTlsConnectionBaseStatus
g_tls_connection_base_real_pop_io (GTlsConnectionBase *tls,
GIOCondition direction,
gboolean success,
- GError *op_error,
+ GError *op_error /* owned */,
GError **error)
{
GTlsConnectionBasePrivate *priv = g_tls_connection_base_get_instance_private (tls);
- GError *my_error = NULL;
/* This function MAY or MAY NOT set error when it fails! */
if (success)
- return G_TLS_CONNECTION_BASE_OK;
-
- g_assert (op_error);
- g_propagate_error (&my_error, op_error);
+ {
+ g_assert (!op_error);
+ return G_TLS_CONNECTION_BASE_OK;
+ }
- if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+ if (g_error_matches (op_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
{
- g_propagate_error (error, my_error);
+ g_propagate_error (error, op_error);
return G_TLS_CONNECTION_BASE_WOULD_BLOCK;
}
- if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT))
+ if (g_error_matches (op_error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT))
{
- g_propagate_error (error, my_error);
+ g_propagate_error (error, op_error);
return G_TLS_CONNECTION_BASE_TIMED_OUT;
}
@@ -824,11 +823,12 @@ g_tls_connection_base_real_pop_io (GTlsConnectionBase *tls,
g_set_error_literal (error, G_TLS_ERROR, G_TLS_ERROR_CERTIFICATE_REQUIRED,
_("Server required TLS certificate"));
}
- g_clear_error (&my_error);
+
+ g_error_free (op_error);
}
- else if (my_error)
+ else if (op_error)
{
- g_propagate_error (error, my_error);
+ g_propagate_error (error, op_error);
}
return G_TLS_CONNECTION_BASE_ERROR;
diff --git a/tls/gnutls/gtlsoperationsthread-gnutls.c b/tls/gnutls/gtlsoperationsthread-gnutls.c
index 99082fc..4714589 100644
--- a/tls/gnutls/gtlsoperationsthread-gnutls.c
+++ b/tls/gnutls/gtlsoperationsthread-gnutls.c
@@ -149,7 +149,6 @@ end_gnutls_io (GTlsOperationsThreadGnutls *self,
GTlsConnectionBase *tls;
GTlsConnectionBaseStatus status;
GError *my_error = NULL;
- GError *op_error = NULL;
/* We intentionally do not check for GNUTLS_E_INTERRUPTED here
* Instead, the caller may poll for the source to become ready again.
@@ -162,11 +161,10 @@ end_gnutls_io (GTlsOperationsThreadGnutls *self,
return G_TLS_CONNECTION_BASE_TRY_AGAIN;
self->op_cancellable = NULL;
- op_error = g_steal_pointer (&self->op_error);
tls = g_tls_operations_thread_base_get_connection (G_TLS_OPERATIONS_THREAD_BASE (self));
- status = g_tls_connection_base_pop_io (tls, direction, ret >= 0, op_error, &my_error);
+ status = g_tls_connection_base_pop_io (tls, direction, ret >= 0, g_steal_pointer (&self->op_error),
&my_error);
if (status == G_TLS_CONNECTION_BASE_OK ||
status == G_TLS_CONNECTION_BASE_WOULD_BLOCK ||
status == G_TLS_CONNECTION_BASE_TIMED_OUT)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]