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. --- src/gnutls.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gnutls.c') diff --git a/src/gnutls.c b/src/gnutls.c index 01a5983d3b0..d11b11c7c54 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -686,6 +686,16 @@ emacs_gnutls_deinit (Lisp_Object proc) return Qt; } +DEFUN ("gnutls-mark-process", Fgnutls_mark_process, Sgnutls_mark_process, 2, 2, 0, + doc: /* Mark this process as being a pre-init GnuTLS process. */) + (Lisp_Object proc, Lisp_Object state) +{ + CHECK_PROCESS (proc); + + XPROCESS (proc)->gnutls_wait_p = !NILP (state); + return Qnil; +} + DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0, doc: /* Return the GnuTLS init stage of process PROC. See also `gnutls-boot'. */) @@ -1693,6 +1703,7 @@ syms_of_gnutls (void) make_number (GNUTLS_E_APPLICATION_ERROR_MIN)); defsubr (&Sgnutls_get_initstage); + defsubr (&Sgnutls_mark_process); defsubr (&Sgnutls_errorp); defsubr (&Sgnutls_error_fatalp); defsubr (&Sgnutls_error_string); -- cgit v1.2.1