[glib-networking/glib-2-68] Make handshake ops ignore cancellation
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/glib-2-68] Make handshake ops ignore cancellation
- Date: Wed, 1 Dec 2021 21:08:25 +0000 (UTC)
commit ae9201a5682dc8aaca452aceaf34e9ecc94df115
Author: Michael Catanzaro <mcatanzaro redhat com>
Date: Tue Nov 30 11:18:08 2021 -0600
Make handshake ops ignore cancellation
This is bad, because it means the operation will no longer complete
immediately if cancelled by the API user. But it's better than crashing,
which is what is happening now. The underlying handshake operation is
synchronous, and this is tough to change, so we currently use
g_task_set_return_on_cancel() to fake it: this lets the API user think
the operation has completed, even if it's still running on the handshake
thread. Problem is this is broken and cannot be fixed easily:
glib-networking is not actually prepared for the task to finish early
like this. For now, ignoring cancellation is the most practical
solution to avoid crashes.
Of course this is not a good long-term solution. I have added a bullet
point to #89 in order to ensure I don't forget that we need to fix
cancellation.
Fixes #97, fixes #176
(cherry picked from commit 30ad18457b3ea71fbbc6c85964ddb7add464c548)
(cherry picked from commit 217109a6b81219f0ca967b68905403707dadb092)
tls/base/gtlsconnection-base.c | 2 --
1 file changed, 2 deletions(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index f07c95c7..157efb05 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -1685,7 +1685,6 @@ g_tls_connection_base_handshake (GTlsConnection *conn,
task = g_task_new (conn, cancellable, sync_handshake_thread_completed, NULL);
g_task_set_source_tag (task, g_tls_connection_base_handshake);
g_task_set_name (task, "[glib-networking] g_tls_connection_base_handshake");
- g_task_set_return_on_cancel (task, TRUE);
timeout = g_new0 (gint64, 1);
*timeout = -1; /* blocking */
@@ -1928,7 +1927,6 @@ do_implicit_handshake (GTlsConnectionBase *tls,
g_mutex_unlock (&priv->op_mutex);
- g_task_set_return_on_cancel (priv->implicit_handshake, TRUE);
g_task_run_in_thread (priv->implicit_handshake, handshake_thread);
crank_sync_handshake_context (tls, cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]