From: Lars Ingebrigtsen <larsi@gnus.org>
To: emacs-devel@gnu.org
Subject: Asynchronous Network Security Manager
Date: Mon, 15 Feb 2016 16:25:14 +1100 [thread overview]
Message-ID: <877fi6h7et.fsf@gnus.org> (raw)
We've made the changes Eli suggested, so now we have the very final
problem associated with the async stuff: The network security manager.
We have not had asynchronous TLS connections until now, so we haven't
really had this problem before.
`open-network-stream', if given :type 'tls, would call
`network-stream-open-tls'. It used to start like this:
(defun network-stream-open-tls (name buffer host service parameters)
[...]
(stream
(funcall (if (gnutls-available-p)
'open-gnutls-stream
'open-tls-stream)
[...]
;; Check certificate validity etc.
(when (and (gnutls-available-p) stream)
(setq stream (nsm-verify-connection stream host service)))
With async TLS, the negotiation takes place later, of course, and
calling `nsm-verify-connection' here makes no sense.
network-stream-open-tls could put a sentinel on the process, but the
common application use case is
(progn
(setq proc (open-network-stream ...))
(set-process-sentinel proc ...))
so that obviously doesn't work.
I see two solutions:
1) We require callers to call `nsm-verify-connection' themselves in
their own sentinels. (Yuck.)
2) We call `nsm-verify-connection' after the asynchronous TLS
negotiation has finished, and before notifying the user sentinel that
the socket has connected.
Hm... I've never called complex Lisp code from the C layer before. Is
that an A-OK thing to do?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next reply other threads:[~2016-02-15 5:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 5:25 Lars Ingebrigtsen [this message]
2016-02-15 6:16 ` Asynchronous Network Security Manager Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877fi6h7et.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).