From 42ef3013781146c62ece536c10c50bb5a5dc1f78 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 1 Feb 2016 03:26:09 +0100 Subject: [PATCH] Always boot TLS if given parameters * src/process.c (connect_network_socket): If we have the TLS parameters, then boot the socket. --- src/gnutls.c | 2 +- src/process.c | 23 ++++++++++++----------- src/process.h | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/gnutls.c b/src/gnutls.c index a0b6e0df68b..fb3c3c22777 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -695,7 +695,7 @@ to finish setting up the connection. */) { CHECK_PROCESS (proc); - XPROCESS (proc)->gnutls_async_parameters = params; + XPROCESS (proc)->gnutls_boot_parameters = params; return Qnil; } diff --git a/src/process.c b/src/process.c index 13f4b6aa85e..8849b20172f 100644 --- a/src/process.c +++ b/src/process.c @@ -710,7 +710,7 @@ make_process (Lisp_Object name) #ifdef HAVE_GNUTLS p->gnutls_initstage = GNUTLS_STAGE_EMPTY; - p->gnutls_async_parameters = Qnil; + p->gnutls_boot_parameters = Qnil; #endif /* If name is already in use, modify it until it is unused. */ @@ -3304,16 +3304,17 @@ void connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses) #ifdef HAVE_GNUTLS /* Continue the asynchronous connection. */ - if (!NILP (p->gnutls_async_parameters) && p->is_non_blocking_client) { - Lisp_Object boot, params = p->gnutls_async_parameters; + if (!NILP (p->gnutls_boot_parameters)) + { + Lisp_Object boot, params = p->gnutls_boot_parameters; - p->gnutls_async_parameters = Qnil; - boot = Fgnutls_boot (proc, XCAR (params), XCDR (params)); - if (NILP (boot) || STRINGP (boot)) { - pset_status (p, Qfailed); - deactivate_process (proc); + p->gnutls_boot_parameters = Qnil; + boot = Fgnutls_boot (proc, XCAR (params), XCDR (params)); + if (NILP (boot) || STRINGP (boot)) { + pset_status (p, Qfailed); + deactivate_process (proc); + } } - } #endif } @@ -3831,7 +3832,7 @@ usage: (make-network-process &rest ARGS) */) #ifdef HAVE_GNUTLS tem = Fplist_get (contact, QCtls_parameters); CHECK_LIST (tem); - p->gnutls_async_parameters = tem; + p->gnutls_boot_parameters = tem; #endif unbind_to (count, Qnil); @@ -5891,7 +5892,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, #ifdef HAVE_GNUTLS /* The TLS connection hasn't been set up yet, so we can't write anything on the socket. */ - if (p->gnutls_async_parameters) + if (p->gnutls_boot_parameters) return; #endif diff --git a/src/process.h b/src/process.h index 828330ba9df..c7531576915 100644 --- a/src/process.h +++ b/src/process.h @@ -106,7 +106,7 @@ struct Lisp_Process #ifdef HAVE_GNUTLS Lisp_Object gnutls_cred_type; - Lisp_Object gnutls_async_parameters; + Lisp_Object gnutls_boot_parameters; #endif /* Pipe process attached to the standard error of this process. */ -- 2.39.5