]> git.eshelyaron.com Git - emacs.git/commitdiff
Tweak TLS error messaging on closed connections
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 24 Jan 2017 23:23:28 +0000 (00:23 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 24 Jan 2017 23:23:28 +0000 (00:23 +0100)
* 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

index 735d2e3581008cbcf7f96b76da3877f66f7c23fb..6fa0e1097280f1870778612db2667fe5122bc6e7 100644 (file)
@@ -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
     {