Subject: ares_process() causing delay inspite of setting timeout value

ares_process() causing delay inspite of setting timeout value

From: Vinay Kumar <win_i008_at_yahoo.com>
Date: Fri, 14 Nov 2014 11:01:41 +0000 (UTC)

Hi, I am using  ‘c-ares’ library in our application.
The following piece of code generates the delay(taking around 4sec) when DNS Server responds slowly even aftersetting the timeout value as 25ms:The delay is happening in ares_process() function. static void wait_ares(ares_channel channel){intnfds, count;fd_setreaders, writers;structtimeval tv, tv1,*tvp; tv1.tv_sec= 0;tv1.tv_usec= 25000;                while(1){FD_ZERO(&readers);FD_ZERO(&writers);nfds= ares_fds(channel, &readers, &writers);if(nfds == 0)break;tvp= ares_timeout(channel, &tv1, &tv);count= select(nfds, &readers, &writers, NULL, tvp);ares_process(channel,&readers, &writers);}} Pleaselet me know, what changes has to be done to set the maximum timeout values for makingthe DNS query requests. NOTE:  Avoiding the wait_ares() function reduces the delay, but I am not sure whether itcauses any problem. Regards,Vinay
Received on 2014-11-14