summaryrefslogtreecommitdiff
path: root/gweb/gresolv.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-12-01 16:35:58 +0000
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-12-01 16:35:58 +0000
commit3c9edd5e215d2939b0f61c7f6cd87d30c6965f6d (patch)
tree522b088ffe401b5d2f2c7e3e1deb09593f660923 /gweb/gresolv.c
parent311f0b1124d761ef510510c5f74c8d02b71ea6d3 (diff)
downloadconnman-3c9edd5e215d2939b0f61c7f6cd87d30c6965f6d.tar.gz
connman-3c9edd5e215d2939b0f61c7f6cd87d30c6965f6d.tar.bz2
connman-3c9edd5e215d2939b0f61c7f6cd87d30c6965f6d.zip
gresolv: Handle POLLERR on DNS UDP socket
If we get an error on the UDP socket, we'll currently go into an endless loop eating CPU with poll() returning POLLERR and us ignoring it. This at least hooks things up so that our callback gets called, and we stop looping. But the callback's handling of POLLERR isn't correct. It should close the socket and open a new one. As it is, it's just going to try to use the same broken socket again for the next request. But at least with this patch it'll stop eating CPU.
Diffstat (limited to 'gweb/gresolv.c')
-rw-r--r--gweb/gresolv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gweb/gresolv.c b/gweb/gresolv.c
index afd0653d..99dc57a1 100644
--- a/gweb/gresolv.c
+++ b/gweb/gresolv.c
@@ -329,8 +329,8 @@ static int connect_udp_channel(struct resolv_nameserver *nameserver)
g_io_channel_set_close_on_unref(nameserver->udp_channel, TRUE);
nameserver->udp_watch = g_io_add_watch(nameserver->udp_channel,
- G_IO_IN, received_udp_data,
- nameserver);
+ G_IO_IN | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
+ received_udp_data, nameserver);
return 0;
}