From: David Woodhouse Date: Wed, 1 Dec 2010 16:35:58 +0000 (+0000) Subject: gresolv: Handle POLLERR on DNS UDP socket X-Git-Tag: 0.65~120 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c9edd5e215d2939b0f61c7f6cd87d30c6965f6d;p=platform%2Fupstream%2Fconnman.git 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. --- diff --git a/gweb/gresolv.c b/gweb/gresolv.c index afd0653..99dc57a 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; }