Mercurial > pidgin
diff libgaim/protocols/simple/simple.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 |
line wrap: on
line diff
--- a/libgaim/protocols/simple/simple.c Sun Aug 20 22:16:13 2006 +0000 +++ b/libgaim/protocols/simple/simple.c Sun Aug 20 22:24:13 2006 +0000 @@ -1527,6 +1527,8 @@ struct simple_account_data *sip = (struct simple_account_data*) data; int addr_size; + sip->query_data = NULL; + if (!hosts || !hosts->data) { gaim_connection_error(sip->gc, _("Couldn't resolve host")); return; @@ -1622,7 +1624,10 @@ } else { /* UDP */ gaim_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); - gaim_dnsquery_a(hostname, port, simple_udp_host_resolved, sip); + sip->query_data = gaim_dnsquery_a(hostname, port, simple_udp_host_resolved, sip); + if (sip->query_data == NULL) { + gaim_connection_error(sip->gc, _("Could not resolve hostname")); + } } } @@ -1689,6 +1694,9 @@ do_register_exp(sip, 0); connection_free_all(sip); + if (sip->query_data != NULL) + gaim_dnsquery_destroy(sip->query_data); + g_free(sip->servername); g_free(sip->username); g_free(sip->password);
