summaryrefslogtreecommitdiff
path: root/src/dnsproxy.c
diff options
context:
space:
mode:
authorPaulo Pizarro <paulo.pizarro@gmail.com>2012-06-17 23:22:37 -0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-06-18 13:31:49 +0300
commit335e7562aafe49d4f91184ebe4d84d1aa99b9ca7 (patch)
tree07c373020999d3f73b75df6f4ac2e658660c6eda /src/dnsproxy.c
parentaab0baede4eca5fa5d539bf0cffcb712f0453486 (diff)
downloadconnman-335e7562aafe49d4f91184ebe4d84d1aa99b9ca7.tar.gz
connman-335e7562aafe49d4f91184ebe4d84d1aa99b9ca7.tar.bz2
connman-335e7562aafe49d4f91184ebe4d84d1aa99b9ca7.zip
dnsproxy: If no request was sent then the TCP server is destroyed
Diffstat (limited to 'src/dnsproxy.c')
-rw-r--r--src/dnsproxy.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 71efe6af..58d1bfe2 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;