[glib] gsocketclient: Handle cancellation between CONNECTING and CONNECTED
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gsocketclient: Handle cancellation between CONNECTING and CONNECTED
- Date: Fri, 22 Aug 2014 18:11:46 +0000 (UTC)
commit cb320cb5feb78a5a06651d3223914d9099a6f212
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Aug 21 19:00:13 2014 +0100
gsocketclient: Handle cancellation between CONNECTING and CONNECTED
If a g_socket_client_connect_async() operation is cancelled between the
CONNECTING and CONNECTED events (i.e. while in the
g_socket_connection_connect_async() call), the code in
g_socket_client_connected_callback() would previously unconditionally
loop round and try the next socket address from the address enumerator
(by calling enumerator_next_async()). This would correctly handle the
cancellation and return from the overall task — but not before emitting
a spurious RESOLVING event.
Avoid emitting the spurious RESOLVING event by explicitly handling
cancellation at the beginning of g_socket_client_connected_callback().
https://bugzilla.gnome.org/show_bug.cgi?id=735179
gio/gsocketclient.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
index 382b6b6..2cd9893 100644
--- a/gio/gsocketclient.c
+++ b/gio/gsocketclient.c
@@ -1492,6 +1492,12 @@ g_socket_client_connected_callback (GObject *source,
GProxy *proxy;
const gchar *protocol;
+ if (g_task_return_error_if_cancelled (data->task))
+ {
+ g_object_unref (data->task);
+ return;
+ }
+
if (!g_socket_connection_connect_finish (G_SOCKET_CONNECTION (source),
result, &error))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]