From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alain Schneble Newsgroups: gmane.emacs.devel Subject: Re: Asynchronous DNS Date: Sun, 7 Feb 2016 18:45:53 +0100 Message-ID: <86egcomn1q.fsf@realize.ch> 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> <83io25yeqk.fsf@gnu.org> <87h9hpnreg.fsf@gnus.org> <83y4b0wi7m.fsf@gnu.org> <87si17evk6.fsf@gnus.org> <83twlnvcz2.fsf@gnu.org> <87vb63obm3.fsf@gnus.org> <87r3gqmg6g.fsf@gnus.org> <83egcqtfnm.fsf@gnu.org> <86mvrdmk8p.fsf@realize.ch> <83mvrcsefa.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454867204 3930 80.91.229.3 (7 Feb 2016 17:46:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Feb 2016 17:46:44 +0000 (UTC) Cc: larsi@gnus.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 07 18:46:39 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 1aSTPy-0005Oe-9R for ged-emacs-devel@m.gmane.org; Sun, 07 Feb 2016 18:46:38 +0100 Original-Received: from localhost ([::1]:36742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSTPx-0001Xn-HY for ged-emacs-devel@m.gmane.org; Sun, 07 Feb 2016 12:46:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSTPt-0001XY-UQ for emacs-devel@gnu.org; Sun, 07 Feb 2016 12:46:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSTPs-0000gq-Vh for emacs-devel@gnu.org; Sun, 07 Feb 2016 12:46:33 -0500 Original-Received: from clientmail.realize.ch ([46.140.89.53]:1589) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aSTPm-0000g9-Li; Sun, 07 Feb 2016 12:46:26 -0500 Original-Received: from rintintin.hq.realize.ch.lan.rit ([192.168.0.105]) by clientmail.realize.ch ; Sun, 7 Feb 2016 18:46:16 +0100 Original-Received: from MYNGB (192.168.66.64) by rintintin.hq.realize.ch.lan.rit (192.168.0.105) with Microsoft SMTP Server (TLS) id 15.0.516.32; Sun, 7 Feb 2016 18:45:57 +0100 In-Reply-To: <83mvrcsefa.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Feb 2016 17:55:37 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) X-ClientProxiedBy: rintintin.hq.realize.ch.lan.rit (192.168.0.105) To rintintin.hq.realize.ch.lan.rit (192.168.0.105) X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] X-Received-From: 46.140.89.53 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:199449 Archived-At: Eli Zaretskii writes: > That's not my reading of the code. Perhaps I'm missing something. > Could you tell the details -- where do you see this? The probability that I'm missing something is infinitely larger ;) And at the same time I'm infinitely thankful to you and Lars for taking the time to read my messages so thoroughly. > What I see is this: process-send-string calls send_process, which > signals an error if either the status of the process object is other > than 'run' or its output file descriptor is invalid. But > make-network-process takes care to arrange for both of these: it calls > make_process, which sets the process status to 'run' and sets up its > output file descriptor to a valid value (the socket we got from the > call to 'socket'). Up to this point, I fully agree. > It does that even if the connection is > asynchronous and has not yet completed. So I don't expect an error in > this scenario with the existing code. Well, there's this code a few lines after p->outfd has been set, in connect_network_socket: if (p->is_non_blocking_client) { /* We may get here if connect did succeed immediately. However, in that case, we still need to signal this like a non-blocking connection. */ pset_status (p, Qconnect); if (!FD_ISSET (inch, &connect_wait_mask)) { FD_SET (inch, &connect_wait_mask); FD_SET (inch, &write_mask); num_pending_connects++; } } else To me this reads like the process status is set to Qconnect until the asynchronous connection is fully set up. Near the end of wait_reading_process_output, the status is set to Qrun again just before invoking the sentinel function: pset_status (p, Qrun); ... exec_sentinel (proc, build_string ("open\n")); > If the connection is asynchronous, and is not yet completed, then > send_process will wait in a loop, because the write to the socket will > return EWOULDBLOCK or EAGAIN. This I see, but only if the above mentioned Qconnect state wouldn't be there. > Did I miss something? Am I misinterpreting it?