summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-09-24 20:24:04 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-09-24 20:24:04 +0200
commit81e5198222aae4f4c7f0b243c09a602c452a813a (patch)
tree6a283dd1f570f88300226d94a44e1799e108d497 /plugins
parentb4f3033cd0153e91561270ece6083f6fb0892fea (diff)
downloadconnman-81e5198222aae4f4c7f0b243c09a602c452a813a.tar.gz
connman-81e5198222aae4f4c7f0b243c09a602c452a813a.tar.bz2
connman-81e5198222aae4f4c7f0b243c09a602c452a813a.zip
Stop polling the nameserver TCP socket once we're done with it
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dnsproxy.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c
index d383db1f..a1743937 100644
--- a/plugins/dnsproxy.c
+++ b/plugins/dnsproxy.c
@@ -557,7 +557,7 @@ static gboolean tcp_server_event(GIOChannel *channel, GIOCondition condition,
while (total_bytes_recv < reply_len) {
bytes_recv = recv(sk, reply + 2, reply_len, 0);
if (bytes_recv < 0)
- return TRUE;
+ break;
total_bytes_recv += bytes_recv;
}
@@ -565,6 +565,8 @@ static gboolean tcp_server_event(GIOChannel *channel, GIOCondition condition,
forward_dns_reply(reply, reply_len + 2, IPPROTO_TCP);
g_free(reply);
+
+ return FALSE;
}
return TRUE;
@@ -608,8 +610,14 @@ static struct server_data *create_server(const char *interface,
}
data = find_server(interface, domain, server, protocol);
- if (data)
+ if (data) {
+ if (data->watch > 0)
+ g_source_remove(data->watch);
+ data->watch = g_io_add_watch(data->channel,
+ G_IO_OUT | G_IO_IN | G_IO_HUP | G_IO_NVAL | G_IO_ERR,
+ tcp_server_event, data);
return data;
+ }
sk = socket(AF_INET, type, protocol);
if (sk < 0) {