From 42e23674133e881092c05814c6e11224e642f5f8 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 25 Jan 2017 00:23:28 +0100 Subject: [PATCH] Tweak TLS error messaging on closed connections * src/gnutls.c (emacs_gnutls_handle_error): Demote the normal peer-closed-connection "The TLS connection was non-properly terminated" message to a lower level so that it isn't shown to the user by default. --- src/gnutls.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gnutls.c b/src/gnutls.c index 735d2e35810..6fa0e109728 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -582,8 +582,15 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) if (gnutls_error_is_fatal (err)) { + int level = 1; + /* Mostly ignore "The TLS connection was non-properly + terminated" message which just means that the peer closed the + connection. */ + if (err == GNUTLS_E_PREMATURE_TERMINATION) + level = 3; + + GNUTLS_LOG2 (level, max_log_level, "fatal error:", str); ret = 0; - GNUTLS_LOG2 (1, max_log_level, "fatal error:", str); } else { -- 2.39.2