From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#22493: 25.1.50; open-gnutls-stream doesn't respect :nowait, so the connections are synchronous Date: Sun, 31 Jan 2016 01:40:51 +0100 Message-ID: <878u36fung.fsf@gnus.org> References: <87mvrnzpge.fsf@gnus.org> <878u37zndq.fsf@gnus.org> <83r3gzwhg8.fsf@gnu.org> <87fuxebrsy.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454200943 16512 80.91.229.3 (31 Jan 2016 00:42:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Jan 2016 00:42:23 +0000 (UTC) To: 22493@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 31 01:42:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1aPg5i-0001dD-36 for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Jan 2016 01:42:10 +0100 Original-Received: from localhost ([::1]:40181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPg5h-0001W6-Fp for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Jan 2016 19:42:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPg5d-0001Vx-T0 for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2016 19:42:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPg5a-0000Ig-NE for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2016 19:42:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPg5a-0000IZ-JJ for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2016 19:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aPg5a-0002wT-FZ for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2016 19:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jan 2016 00:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22493 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22493-submit@debbugs.gnu.org id=B22493.145420088011262 (code B ref 22493); Sun, 31 Jan 2016 00:42:02 +0000 Original-Received: (at 22493) by debbugs.gnu.org; 31 Jan 2016 00:41:20 +0000 Original-Received: from localhost ([127.0.0.1]:42417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aPg4u-0002va-2N for submit@debbugs.gnu.org; Sat, 30 Jan 2016 19:41:20 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:35217) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aPg4s-0002vR-He for 22493@debbugs.gnu.org; Sat, 30 Jan 2016 19:41:19 -0500 Original-Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aPg4U-0004UL-Ug for 22493@debbugs.gnu.org; Sun, 31 Jan 2016 01:40:55 +0100 In-Reply-To: <87fuxebrsy.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 30 Jan 2016 23:55:57 +0100") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aPg4U-0004UL-Ug MailScanner-NULL-Check: 1454805655.73959@iAgOhfm3zZ6+vCXACPdnmg X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:112120 Archived-At: I have now implemented this, but in a slightly different way. I introduced a new process slot to say that we shouldn't be writing yet. However, the Lisp part of the implementation is not very satisfactory. This is basically it: (let ((process (open-network-stream name buffer host service :nowait nowait))) (if nowait (progn (gnutls-mark-process process t) (set-process-sentinel process 'gnutls-async-sentinel) process) (gnutls-negotiate :process (open-network-stream name buffer host service) :type 'gnutls-x509pki :hostname host)))) ... (defun gnutls-async-sentinel (process change) (when (string-match "open" change) (gnutls-negotiate :process process :type 'gnutls-x509pki :hostname (car (process-contact process))) (gnutls-mark-process process nil))) The problem here is that this library is now putting a sentinel on the process. But any callers that want an asynchronous connection will also be setting sentinels on the same process, which means that the connection sentinel will be overwritten. I've kludged this together in one of the callers (in url-http.el), but that's too ugly to live. (It checks for a sentinel and daisy-chains the previous one. Eek.) So that has to be rewritten. But I'm not sure how... We, like, have several layers of possible sentinels here, and... uhm... Ideas? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no