From 3c9edd5e215d2939b0f61c7f6cd87d30c6965f6d Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 1 Dec 2010 16:35:58 +0000 Subject: 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. --- gweb/gresolv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gweb') 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; } -- cgit v1.2.3