GNU bug report logs -
#22789
25.1.50; In last master build https connections stop working
Previous Next
Full log
Message #287 received at 22789 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Alain Schneble <a.s <at> realize.ch> writes:
> Alain Schneble <a.s <at> realize.ch> writes:
>
> And here is the intermediate-and-not-cleaned-up patch:
Sorry, the former patch did break the new retry_for_async flag. Here is
a corrected one (but still experimental...):
[0001-Wait-for-GnuTLS-handshake-until-socket-is-connected.patch (text/x-patch, inline)]
From eedbcea0224febf579bedb44a9bb2b280abcdc4a Mon Sep 17 00:00:00 2001
From: Alain Schneble <a.s <at> realize.ch>
Date: Fri, 4 Mar 2016 23:17:07 +0100
Subject: [PATCH] Wait for GnuTLS handshake until socket is connected
* src/gnutls.c (emacs_gnutls_handshake, gnutls_try_handshake): Skip
GnuTLS handshake when gnutls_boot is called on async socket (aka non
blocking client).
* src/process.c (connect_network_socket, wait_reading_process_output):
Proceed with GnuTLS handshake only after async socket has been
connected.
---
src/gnutls.c | 9 ++++++---
src/process.c | 13 +++++++++----
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/gnutls.c b/src/gnutls.c
index 988c010..4962ecc 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -403,9 +403,6 @@ gnutls_try_handshake (struct Lisp_Process *proc)
gnutls_session_t state = proc->gnutls_state;
int ret;
- if (proc->is_non_blocking_client)
- proc->gnutls_p = true;
-
do
{
ret = gnutls_handshake (state);
@@ -474,6 +471,12 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET;
}
+ if (proc->is_non_blocking_client)
+ {
+ proc->gnutls_p = true;
+ return GNUTLS_E_AGAIN;
+ }
+
return gnutls_try_handshake (proc);
}
diff --git a/src/process.c b/src/process.c
index 4359f68..d73586c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3415,7 +3415,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
if (p->gnutls_initstage == GNUTLS_STAGE_READY)
/* Run sentinels, etc. */
finish_after_tls_connection (proc);
- else if (p->gnutls_initstage != GNUTLS_STAGE_HANDSHAKE_TRIED)
+ else if ((! p->is_non_blocking_client && p->gnutls_initstage != GNUTLS_STAGE_HANDSHAKE_TRIED) ||
+ (p->is_non_blocking_client && p->gnutls_initstage != GNUTLS_STAGE_TRANSPORT_POINTERS_SET))
{
deactivate_process (proc);
if (NILP (boot))
@@ -4950,11 +4951,15 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
#endif
#ifdef HAVE_GNUTLS
/* Continue TLS negotiation. */
- if (p->gnutls_initstage == GNUTLS_STAGE_HANDSHAKE_TRIED
+ if ((p->gnutls_initstage == GNUTLS_STAGE_TRANSPORT_POINTERS_SET ||
+ p->gnutls_initstage == GNUTLS_STAGE_HANDSHAKE_TRIED)
&& p->is_non_blocking_client)
{
- gnutls_try_handshake (p);
- p->gnutls_handshakes_tried++;
+ if (! FD_ISSET (p->outfd, &connect_wait_mask))
+ {
+ gnutls_try_handshake (p);
+ p->gnutls_handshakes_tried++;
+ }
if (p->gnutls_initstage == GNUTLS_STAGE_READY)
{
--
2.6.2.windows.1
This bug report was last modified 9 years and 132 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.