From 9f5e5eb4732b4d0e4ffd7090685a078d48e763be Mon Sep 17 00:00:00 2001 From: discomfitor Date: Thu, 7 Jun 2012 07:22:53 +0000 Subject: [PATCH] on the advice of the insightful creator of dns.c, account for when a UDP answer is truncated and the resolver switches to TCP, causing the pollfd descriptor will change. Any poll on this old descriptor will either timeout or continually poll as ready git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@71776 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_con/ecore_con_dns.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/ecore_con/ecore_con_dns.c b/src/lib/ecore_con/ecore_con_dns.c index 48082df..93ca8c8 100644 --- a/src/lib/ecore_con/ecore_con_dns.c +++ b/src/lib/ecore_con/ecore_con_dns.c @@ -115,10 +115,16 @@ error: } static Eina_Bool -_dns_fd_cb(Ecore_Con_DNS *dns, Ecore_Fd_Handler *fdh) +_dns_fd_cb(Ecore_Con_DNS *dns, Ecore_Fd_Handler *fdh __UNUSED__) { - if (_ecore_con_dns_check(dns) == 1) - ecore_main_fd_handler_active_set(fdh, dns_ai_events(dns->ai)); + if (_ecore_con_dns_check(dns) != 1) return ECORE_CALLBACK_RENEW; + if (ecore_main_fd_handler_fd_get(dns->fdh) != dns_ai_pollfd(dns->ai)) + { + ecore_main_fd_handler_del(dns->fdh); + dns->fdh = ecore_main_fd_handler_add(dns_ai_pollfd(dns->ai), dns_ai_events(dns->ai), (Ecore_Fd_Cb)_dns_fd_cb, dns, NULL, NULL); + } + else + ecore_main_fd_handler_active_set(dns->fdh, dns_ai_events(dns->ai)); return ECORE_CALLBACK_RENEW; } -- 2.7.4