Mercurial > pidgin
diff libpurple/proxy.c @ 32802:fa666e7f747e
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 55372aac7eca74e2a3121931b867702d2fdfe299)
to branch 'im.pidgin.pidgin' (head 1f233991b11d30d7bd9d1e058e19fe162a9600f3)
| author | Elliott Sales de Andrade <qulogic@pidgin.im> |
|---|---|
| date | Fri, 25 May 2012 19:41:04 +0000 |
| parents | 0c2efa69492b 5ae7e1f36b43 |
| children | 2c6510167895 |
line wrap: on
line diff
--- a/libpurple/proxy.c Fri May 25 19:28:41 2012 +0000 +++ b/libpurple/proxy.c Fri May 25 19:41:04 2012 +0000 @@ -69,6 +69,8 @@ */ GSList *hosts; + PurpleProxyConnectData *child; + /* * All of the following variables are used when establishing a * connection through a proxy. @@ -569,6 +571,12 @@ static void purple_proxy_connect_data_disconnect(PurpleProxyConnectData *connect_data, const gchar *error_message) { + if (connect_data->child != NULL) + { + purple_proxy_connect_cancel(connect_data->child); + connect_data->child = NULL; + } + if (connect_data->inpa > 0) { purple_input_remove(connect_data->inpa); @@ -2415,12 +2423,19 @@ /* This is the PurpleProxyConnectData for the overall SOCKS5 connection */ PurpleProxyConnectData *connect_data = data; + purple_debug_error("proxy", "Connect Data is %p\n", connect_data); + /* Check that the overall SOCKS5 connection wasn't cancelled while we were * connecting to it (we don't have a way of associating the process of * connecting to the SOCKS5 server to the overall PurpleProxyConnectData) */ - if (!PURPLE_PROXY_CONNECT_DATA_IS_VALID(connect_data)) + if (!PURPLE_PROXY_CONNECT_DATA_IS_VALID(connect_data)) { + purple_debug_error("proxy", "Data had gone out of scope :(\n"); return; + } + + /* Break the link between the two PurpleProxyConnectDatas */ + connect_data->child = NULL; if (error_message != NULL) { purple_debug_error("proxy", "Unable to connect to SOCKS5 host.\n"); @@ -2484,10 +2499,7 @@ return NULL; } - /* The API doesn't really provide us with a way to cancel the specific - * proxy connection attempt (account_proxy_conn_data) when the overall - * SOCKS5 connection (connect_data) attempt is cancelled :( - */ + connect_data->child = account_proxy_conn_data; handles = g_slist_prepend(handles, connect_data); @@ -2497,6 +2509,8 @@ void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data) { + g_return_if_fail(connect_data != NULL); + purple_proxy_connect_data_disconnect(connect_data, NULL); purple_proxy_connect_data_destroy(connect_data); }
