From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Asynchronous DNS resolving Date: Sun, 15 Feb 2015 16:31:39 +1100 Message-ID: <87fva7bv0k.fsf@building.gnus.org> References: <877fvmffrz.fsf@building.gnus.org> <83siea42sz.fsf@gnu.org> <87y4o2mbfp.fsf@building.gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423978385 4672 80.91.229.3 (15 Feb 2015 05:33:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Feb 2015 05:33:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 15 06:32:55 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YMrp8-0006kJ-Vm for ged-emacs-devel@m.gmane.org; Sun, 15 Feb 2015 06:32:55 +0100 Original-Received: from localhost ([::1]:33609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMrp7-0007Jq-Vj for ged-emacs-devel@m.gmane.org; Sun, 15 Feb 2015 00:32:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMrp2-0007Jh-Cx for emacs-devel@gnu.org; Sun, 15 Feb 2015 00:32:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMroy-0001SR-Nb for emacs-devel@gnu.org; Sun, 15 Feb 2015 00:32:48 -0500 Original-Received: from smtp.syd.comcen.com.au ([203.23.236.77]:4664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMrot-0001Qj-6R; Sun, 15 Feb 2015 00:32:39 -0500 Original-Received: from building.gnus.org ([27.96.197.126]) by smtp.syd.comcen.com.au (8.13.4/8.12.9) with ESMTP id t1F5ViQn000634; Sun, 15 Feb 2015 16:31:44 +1100 (EST) In-Reply-To: <87y4o2mbfp.fsf@building.gnus.org> (Lars Ingebrigtsen's message of "Fri, 13 Feb 2015 20:02:18 +1100") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-comcen-MailScanner-Information: Please contact the ISP for more information X-comcen-MailScanner: Found to be clean X-comcen-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0.118, required 4, AWL 0.02, BAYES_50 0.00, RDNS_NONE 0.10) X-comcen-MailScanner-From: larsi@gnus.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.23.236.77 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183081 Archived-At: Lars Ingebrigtsen writes: > Eli Zaretskii writes: > >> Can't you simulate async resolution with timers? Or even by opening a >> network-process to the DNS server and talking to it directly (which >> can be done asynchronously with filters and sentinels and stuff)? > > That's what dns.el does, but it suffers from not having access to > OS-level funky stuff like possible local caching, and the general > difficulty of getting at the current DNS setup on modern machines. > > Using the C-level resolution functions is the safest best, since libc is > really the authority here... Although using getaddrinfo_a is best, a thought just occurred to me: The main problem with dns.el is that it's not very good at getting the IP address of the domain name server it's supposed to talk to. (Talking DNS itself is really easy.) So if we added a `get-domain-name-server-addresses' C-level function, dns.el could use that, and it'd work more reliably. (That function would basically just call res_init and then return the list of IP addresses.) dns.el is currently mostly used to do reverse resolving of IP addresses for display purposes in Gnus, so this would be a win even if we don't use dns.el for forward resolution. (But we could on systems without getaddrinfo_a, if we wanted.) Would anybody mind if I add the `get-domain-name-server-addresses' function? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/