all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: 22493@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	[thread overview]
Message-ID: <878u36fung.fsf@gnus.org> (raw)
In-Reply-To: <87fuxebrsy.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 30 Jan 2016 23:55:57 +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






  reply	other threads:[~2016-01-31  0:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-30  4:00 bug#22493: 25.1.50; open-gnutls-stream doesn't respect :nowait, so the connections are synchronous Lars Ingebrigtsen
2016-01-30  4:45 ` Lars Ingebrigtsen
2016-01-30  9:21   ` Eli Zaretskii
2016-01-30 22:55     ` Lars Ingebrigtsen
2016-01-31  0:40       ` Lars Ingebrigtsen [this message]
2016-01-31  1:10         ` Lars Ingebrigtsen
2016-01-31 16:00           ` Eli Zaretskii
2016-01-31 15:59         ` Eli Zaretskii
2016-01-31 23:17           ` Lars Ingebrigtsen
2016-02-01  2:41             ` Lars Ingebrigtsen
2016-02-01  3:41             ` Eli Zaretskii
2016-02-01  4:01               ` Lars Ingebrigtsen
2016-02-01 18:50                 ` Eli Zaretskii
2016-02-02  1:43                   ` Lars Ingebrigtsen
2016-02-02 16:10                     ` Eli Zaretskii
2016-02-03  1:10                       ` Lars Ingebrigtsen
2016-02-03  1:58                         ` Lars Ingebrigtsen
2016-02-03 15:52                           ` Eli Zaretskii
2016-02-04  2:47                             ` Lars Ingebrigtsen
2016-02-04 16:39                               ` Eli Zaretskii
2016-02-05  2:36                                 ` Lars Ingebrigtsen
2016-02-05  7:24                                   ` Eli Zaretskii
2016-02-05  7:34                                     ` Lars Ingebrigtsen
2016-02-05  9:18                                       ` Eli Zaretskii
2016-02-06  3:03                                         ` Lars Ingebrigtsen
2016-02-06  7:51                                           ` Eli Zaretskii
2016-02-06  7:57                                             ` Lars Ingebrigtsen
2016-02-03 15:51                         ` Eli Zaretskii
2016-02-04  2:59                           ` Lars Ingebrigtsen
2016-01-31 15:57       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878u36fung.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=22493@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.