From 0f47153b97ae31b82366a857ec2f937c1580b637 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 31 Jan 2016 01:34:45 +0100 Subject: Implement asynchronous GnuTLS connections * doc/misc/emacs-gnutls.texi (Help For Developers): Mention the nowait parameter. * lisp/net/gnutls.el (open-gnutls-stream): Allow asynchronous connections with the new nowait parameter. * lisp/net/network-stream.el (network-stream-open-tls): Pass on :nowait to open-gnutls-stream. * lisp/url/url-http.el (url-http): Don't overwrite the sentinel created by open-gnutls-stream. * src/gnutls.c (Fgnutls_mark_process): New function. * src/process.c (send_process): Don't write to GnuTLS sockets that haven't been initialised yed. * src/process.h: New slot gnutls_wait_p. --- lisp/url/url-http.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lisp/url') diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 222dbc64d68..43b2862e0ea 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1277,7 +1277,17 @@ The return value of this function is the retrieval buffer." (pcase (process-status connection) (`connect ;; Asynchronous connection - (set-process-sentinel connection 'url-http-async-sentinel)) + (if (not (process-sentinel connection)) + (set-process-sentinel connection 'url-http-async-sentinel) + ;; If we already have a sentinel on this process (for + ;; instance on TLS connections), then chain them + ;; together. + (let ((old (process-sentinel connection))) + (set-process-sentinel + connection + `(lambda (proc why) + (funcall ',old proc why) + (url-http-async-sentinel proc why)))))) (`failed ;; Asynchronous connection failed (error "Could not create connection to %s:%d" host port)) -- cgit v1.2.1