From 3029f74ad5b8f989e26673a31c257fa2aa8d7304 Mon Sep 17 00:00:00 2001 From: Paul Eggert
Date: Wed, 3 Aug 2016 01:54:20 -0700 Subject: [PATCH 2/2] Fix non-blocking GnuTLS with slow connection Although the problem is reported for OS X (Bug#23982), it seems to be possible on other POSIXish platforms. * src/gnutls.c (emacs_gnutls_nonblock_errno) [!WINDOWSNT]: New function. (emacs_gnutls_handshake) [!WINDOWSNT]: Use it as the errno function, if non-blocking. (Fgnutls_boot): Use GNUTLS_NONBLOCK if non-blocking. --- src/gnutls.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/gnutls.c b/src/gnutls.c index 681e298..e3e9311 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -411,6 +411,31 @@ gnutls_try_handshake (struct Lisp_Process *proc) return ret; } +#ifndef WINDOWSNT +static int +emacs_gnutls_nonblock_errno (gnutls_transport_ptr_t ptr) +{ + int err = errno; + + switch (err) + { +# ifdef _AIX + /* This is taken from the GnuTLS system_errno function circa 2016; + see