From: Samuel Ortiz Date: Wed, 8 Dec 2010 14:57:12 +0000 (+0100) Subject: dnsproxy: Stop polling a nameserver when connect fails X-Git-Tag: 0.65~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d1e58a4708f64d3e651ba54747171db9385941b;p=platform%2Fupstream%2Fconnman.git dnsproxy: Stop polling a nameserver when connect fails The server data structure also needs to be cleaned up. --- diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c index e59926c..9bc080c 100644 --- a/plugins/dnsproxy.c +++ b/plugins/dnsproxy.c @@ -764,8 +764,23 @@ static struct server_data *create_server(const char *interface, if (ret < 0) { if ((protocol == IPPROTO_TCP && errno != EINPROGRESS) || protocol == IPPROTO_UDP) { + GList *list; + connman_error("Failed to connect to server %s", server); close(sk); + if (data->watch > 0) + g_source_remove(data->watch); + if (data->timeout > 0) + g_source_remove(data->timeout); + g_free(data->server); + g_free(data->interface); + for (list = data->domains; list; list = list->next) { + char *domain = list->data; + + data->domains = g_list_remove(data->domains, + domain); + g_free(domain); + } g_free(data); return NULL; }