GNU bug report logs - #22493
25.1.50; open-gnutls-stream doesn't respect :nowait, so the connections are synchronous

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Sat, 30 Jan 2016 04:02:01 UTC

Severity: normal

Found in version 25.1.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 22493 <at> debbugs.gnu.org
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
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





This bug report was last modified 9 years and 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.