libpurple/proxy.c

changeset 37549
1e58ac9ee097
parent 37537
9e1b392c606b
child 37939
8df8870e946c
--- a/libpurple/proxy.c	Sat Jan 16 10:01:23 2016 -0500
+++ b/libpurple/proxy.c	Mon Jan 18 00:18:07 2016 -0600
@@ -732,11 +732,19 @@
 	conn = g_socket_client_connect_to_host_finish(G_SOCKET_CLIENT(source),
 			res, &error);
 	if (conn == NULL) {
-		purple_debug_error("proxy",
-				"Unable to connect to destination host: %s\n",
-				error->message);
-		purple_proxy_connect_data_disconnect(connect_data,
-				"Unable to connect to destination host.\n");
+		/* Ignore cancelled error as that signifies connect_data has
+		 * been freed
+		 */
+		if (!g_error_matches(error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED)) {
+			purple_debug_error("proxy", "Unable to connect to "
+					"destination host: %s\n",
+					error->message);
+			purple_proxy_connect_data_disconnect(connect_data,
+					"Unable to connect to destination "
+					"host.\n");
+		}
+
 		g_clear_error(&error);
 		return;
 	}
@@ -817,11 +825,19 @@
 	stream = g_proxy_connect_finish(G_PROXY(source), res, &error);
 
 	if (stream == NULL) {
-		purple_debug_error("proxy",
-				"Unable to connect to destination host: %s\n",
-				error->message);
-		purple_proxy_connect_data_disconnect(connect_data,
-				"Unable to connecto to destination host.\n");
+		/* Ignore cancelled error as that signifies connect_data has
+		 * been freed
+		 */
+		if (!g_error_matches(error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED)) {
+			purple_debug_error("proxy", "Unable to connect to "
+					"destination host: %s\n",
+					error->message);
+			purple_proxy_connect_data_disconnect(connect_data,
+					"Unable to connect to destination "
+					"host.\n");
+		}
+
 		g_clear_error(&error);
 		return;
 	}
@@ -869,11 +885,17 @@
 	conn = g_socket_client_connect_to_host_finish(G_SOCKET_CLIENT(source),
 			res, &error);
 	if (conn == NULL) {
-		purple_debug_error("proxy",
-				"Unable to connect to SOCKS5 host: %s\n",
-				error->message);
-		purple_proxy_connect_data_disconnect(connect_data,
-				"Unable to connect to SOCKS5 host.\n");
+		/* Ignore cancelled error as that signifies connect_data has
+		 * been freed
+		 */
+		if (!g_error_matches(error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED)) {
+			purple_debug_error("proxy", "Unable to connect to "
+					"SOCKS5 host: %s\n", error->message);
+			purple_proxy_connect_data_disconnect(connect_data,
+					"Unable to connect to SOCKS5 host.\n");
+		}
+
 		g_clear_error(&error);
 		return;
 	}

mercurial