# HG changeset patch # User Daniel Atallah # Date 1107234160 0 # Node ID e06da39b467c6346b7463f38b70ac45d7940e9f3 # Parent 1db4f49de0c6fa39a76717959e1cf6868ba5a4a7 [gaim-migrate @ 11942] This will prevent the connection process from hanging when the DNS lookup fails. We need to call the callback function regardless of whether the lookup succeeded. (This is in the DNS lookup functionality that is currently #ifdef _WIN32, but is actually portable), committer: Tailor Script diff -r 1db4f49de0c6 -r e06da39b467c src/proxy.c --- a/src/proxy.c Tue Feb 01 04:29:44 2005 +0000 +++ b/src/proxy.c Tue Feb 01 05:02:40 2005 +0000 @@ -651,8 +651,12 @@ static gboolean dns_main_thread_cb(gpointer data) { dns_tdata *td = (dns_tdata*)data; + if (td->errmsg != NULL) { + gaim_debug_info("dns", "%s\n", td->errmsg); + } td->callback(td->hosts, td->data, td->errmsg); g_free(td->hostname); + g_free(td->errmsg); g_free(td); return FALSE; } @@ -662,19 +666,19 @@ dns_tdata *td = (dns_tdata*)data; struct hostent *hp; - if(!(hp = gethostbyname(td->hostname))) { - g_free(td->hostname); - g_free(td); - return 0; - } + if ((hp = gethostbyname(td->hostname))) { + memset(&sin, 0, sizeof(struct sockaddr_in)); + memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); + sin.sin_family = hp->h_addrtype; + sin.sin_port = htons(td->port); - memset(&sin, 0, sizeof(struct sockaddr_in)); - memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); - sin.sin_family = hp->h_addrtype; - sin.sin_port = htons(td->port); - - td->hosts = g_slist_append(td->hosts, GINT_TO_POINTER(sizeof(sin))); - td->hosts = g_slist_append(td->hosts, g_memdup(&sin, sizeof(sin))); + td->hosts = g_slist_append(td->hosts, + GINT_TO_POINTER(sizeof(sin))); + td->hosts = g_slist_append(td->hosts, + g_memdup(&sin, sizeof(sin))); + } else { + td->errmsg = g_strdup_printf("DNS error: %d", errno); + } /* back to main thread */ g_idle_add(dns_main_thread_cb, td); return 0;