From: Samuel Ortiz Date: Fri, 24 Sep 2010 18:39:51 +0000 (+0200) Subject: Close TCP DNS connections once the reply is forwarded X-Git-Tag: 0.62~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4990defa7cdf73d79660a12af31620f67a2ddbf1;p=platform%2Fupstream%2Fconnman.git Close TCP DNS connections once the reply is forwarded This is still sub optimal as the ideal solution would be to keep the TCP connection opened for a 20-30 seconds for the next DNS over TCP requests. --- diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c index a174393..63c88b9 100644 --- a/plugins/dnsproxy.c +++ b/plugins/dnsproxy.c @@ -422,6 +422,8 @@ static void destroy_server(struct server_data *server) { DBG("interface %s server %s", server->interface, server->server); + server_list = g_slist_remove(server_list, server); + if (server->watch > 0) g_source_remove(server->watch); @@ -430,7 +432,8 @@ static void destroy_server(struct server_data *server) g_io_channel_unref(server->channel); - connman_info("Removing DNS server %s", server->server); + if (server->protocol == IPPROTO_UDP) + connman_info("Removing DNS server %s", server->server); g_free(server->server); g_free(server->domain); @@ -499,7 +502,6 @@ static gboolean tcp_server_event(GIOChannel *channel, GIOCondition condition, request_list = g_slist_remove(request_list, req); } - server_list = g_slist_remove(server_list, server); destroy_server(server); return FALSE; @@ -566,6 +568,8 @@ static gboolean tcp_server_event(GIOChannel *channel, GIOCondition condition, g_free(reply); + destroy_server(server); + return FALSE; } @@ -745,8 +749,6 @@ static void remove_server(const char *interface, const char *domain, if (data == NULL) return; - server_list = g_slist_remove(server_list, data); - destroy_server(data); }