From: Paulo Pizarro Date: Mon, 18 Jun 2012 02:22:37 +0000 (-0300) Subject: dnsproxy: If no request was sent then the TCP server is destroyed X-Git-Tag: 2.0_alpha~60 X-Git-Url: http://review.tizen.org/git/?p=framework%2Fconnectivity%2Fconnman.git;a=commitdiff_plain;h=335e7562aafe49d4f91184ebe4d84d1aa99b9ca7 dnsproxy: If no request was sent then the TCP server is destroyed --- diff --git a/src/dnsproxy.c b/src/dnsproxy.c index 71efe6a..58d1bfe 100644 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -1791,6 +1791,7 @@ hangup: if ((condition & G_IO_OUT) && !server->connected) { GSList *list; GList *domains; + int no_request_sent = TRUE; struct server_data *udp_server; udp_server = find_server(server->interface, server->server, @@ -1818,6 +1819,7 @@ hangup: for (list = request_list; list; ) { struct request_data *req = list->data; + int status; if (req->protocol == IPPROTO_UDP) { list = list->next; @@ -1826,8 +1828,9 @@ hangup: DBG("Sending req %s over TCP", (char *)req->name); - if (ns_resolv(server, req, - req->request, req->name) > 0) { + status = ns_resolv(server, req, + req->request, req->name); + if (status > 0) { /* * A cached result was sent, * so the request can be released @@ -1838,6 +1841,13 @@ hangup: continue; } + if (status < 0) { + list = list->next; + continue; + } + + no_request_sent = FALSE; + if (req->timeout > 0) g_source_remove(req->timeout); @@ -1846,6 +1856,11 @@ hangup: list = list->next; } + if (no_request_sent == TRUE) { + destroy_server(server); + return FALSE; + } + } else if (condition & G_IO_IN) { struct partial_reply *reply = server->incoming_reply; int bytes_recv;