From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Asynchronous DNS Date: Wed, 03 Feb 2016 17:50:59 +0200 Message-ID: <83io25yeqk.fsf@gnu.org> References: <87si1gx6wz.fsf@gnus.org> <86y4b5zvzt.fsf@gmail.com> <8760y9kwrk.fsf@gnus.org> <8760y7nag7.fsf@gnus.org> <83oabzzsjq.fsf@gnu.org> <87fuxazkfe.fsf@gnus.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1454515255 4089 80.91.229.3 (3 Feb 2016 16:00:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Feb 2016 16:00:55 +0000 (UTC) Cc: andrewjmoreton@gmail.com, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 03 17:00:53 2016 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 1aQzrI-0001xN-G3 for ged-emacs-devel@m.gmane.org; Wed, 03 Feb 2016 17:00:44 +0100 Original-Received: from localhost ([::1]:35876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQzrE-0002Lg-V5 for ged-emacs-devel@m.gmane.org; Wed, 03 Feb 2016 11:00:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQziF-0006SH-9o for emacs-devel@gnu.org; Wed, 03 Feb 2016 10:51:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQziA-0003d8-9H for emacs-devel@gnu.org; Wed, 03 Feb 2016 10:51:23 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQziA-0003d4-5i; Wed, 03 Feb 2016 10:51:18 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3078 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aQzi8-0006Hj-OY; Wed, 03 Feb 2016 10:51:17 -0500 In-reply-to: <87fuxazkfe.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed, 03 Feb 2016 11:50:29 +1100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:199242 Archived-At: > From: Lars Ingebrigtsen > Cc: andrewjmoreton@gmail.com, emacs-devel@gnu.org > Date: Wed, 03 Feb 2016 11:50:29 +1100 > > erc does the following on connection: > > (make-network-process :name name :buffer buffer > :host host :service service :nowait t) > ... > (when (fboundp 'set-process-coding-system) > (set-process-coding-system process 'raw-text)) > > That function starts with: > > CHECK_PROCESS (process); > p = XPROCESS (process); > if (p->infd < 0) > error ("Input file descriptor of %s closed", SDATA (p->name)); > if (p->outfd < 0) > error ("Output file descriptor of %s closed", SDATA (p->name)); > > And now, :nowait returns even before infd/outfd has been set, which > means the async DNS isn't as invisible to the user as I had hoped... > > We could fix up the callers, of course, but that's a kinda yucky thing > to do. Perhaps my original thought of having a separate :asynchronous > parameter to make-network-stream is a better idea for backwards > compatibility? Or... :nowait 'dns, perhaps. Then the libraries that > want a fully async connection can say that explicitly by changing their > ":nowait t"'s to ":nowait 'dns"? We could remove these sanity checks (in this and many other process-related APIs), they are not strictly necessary, at least not in that function, AFAICS. But I think a better approach is to make all those APIs that check or need a fully-functional process object to wait for DNS completion before they proceed. That would be fully backward-compatible, at the price that the callers will need to be changed to actually take advantage of this feature. Which I think is a Good Thing, because for any application code that wants the async DNS we need a human to seriously consider all the implications and modify the code accordingly. Evidently, this isn't something that can be transparently changed under the hood.