comparison libgaim/proxy.c @ 14238:f189327b9968

[gaim-migrate @ 16920] Cancelable DNS queries. This eliminates crashes when you cancel a connection attempt while we're waiting for a response from a DNS server. I tested with all three methods, so they SHOULD be ok. Let me know if you have problems. I should be around today, starting in maybe an hour. I feel like it's kinda dumb for us to have three implementations for the same thing. I want to get rid of the child-process method (currently used in Unix and OS-X) and use the thread-based method (currently used in Windows) everywhere. Then we can get rid of the third method, too (currently used when !Unix and !OS-X and !Windows) Any objections? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 20 Aug 2006 22:24:13 +0000
parents 60b1bc8dbf37
children baff095b146c
comparison
equal deleted inserted replaced
14237:7cf90e0b6180 14238:f189327b9968
306 gaim_proxy_connect_info_destroy(GaimProxyConnectInfo *connect_info) 306 gaim_proxy_connect_info_destroy(GaimProxyConnectInfo *connect_info)
307 { 307 {
308 gaim_proxy_connect_info_disconnect(connect_info); 308 gaim_proxy_connect_info_disconnect(connect_info);
309 309
310 connect_infos = g_slist_remove(connect_infos, connect_info); 310 connect_infos = g_slist_remove(connect_infos, connect_info);
311
312 if (connect_info->query_data != NULL)
313 gaim_dnsquery_destroy(connect_info->query_data);
311 314
312 while (connect_info->hosts != NULL) 315 while (connect_info->hosts != NULL)
313 { 316 {
314 /* Discard the length... */ 317 /* Discard the length... */
315 connect_info->hosts = g_slist_remove(connect_info->hosts, connect_info->hosts->data); 318 connect_info->hosts = g_slist_remove(connect_info->hosts, connect_info->hosts->data);
1569 connection_host_resolved(GSList *hosts, gpointer data, 1572 connection_host_resolved(GSList *hosts, gpointer data,
1570 const char *error_message) 1573 const char *error_message)
1571 { 1574 {
1572 GaimProxyConnectInfo *connect_info; 1575 GaimProxyConnectInfo *connect_info;
1573 1576
1577 connect_info = data;
1578 connect_info->query_data = NULL;
1579
1574 if (error_message != NULL) 1580 if (error_message != NULL)
1575 { 1581 {
1576 gaim_debug_info("proxy", "Error while resolving hostname: %s\n", error_message); 1582 gchar *tmp;
1577 /* TODO: Destroy connect_info and return? */ 1583 tmp = g_strdup_printf("Error while resolving hostname: %s\n", error_message);
1578 } 1584 gaim_proxy_connect_info_error(connect_info, tmp);
1579 1585 g_free(tmp);
1580 connect_info = data; 1586 return;
1587 }
1588
1581 connect_info->hosts = hosts; 1589 connect_info->hosts = hosts;
1582 1590
1583 try_connect(connect_info); 1591 try_connect(connect_info);
1584 } 1592 }
1585 1593
1819 NULL); 1827 NULL);
1820 gaim_prefs_connect_callback(handle, "/core/proxy/username", 1828 gaim_prefs_connect_callback(handle, "/core/proxy/username",
1821 proxy_pref_cb, NULL); 1829 proxy_pref_cb, NULL);
1822 gaim_prefs_connect_callback(handle, "/core/proxy/password", 1830 gaim_prefs_connect_callback(handle, "/core/proxy/password",
1823 proxy_pref_cb, NULL); 1831 proxy_pref_cb, NULL);
1824 #ifdef _WIN32
1825 if(!g_thread_supported())
1826 g_thread_init(NULL);
1827 #endif
1828 } 1832 }
1829 1833
1830 void 1834 void
1831 gaim_proxy_uninit(void) 1835 gaim_proxy_uninit(void)
1832 { 1836 {