unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Emacs on windows and GnuTLS
Date: Sun, 3 Nov 2013 17:16:34 +0000 (UTC)	[thread overview]
Message-ID: <loom.20131103T180731-886@post.gmane.org> (raw)
In-Reply-To: 877gcpu3bu.fsf@flea.lifelogs.com

Ted Zlatanov <tzz <at> lifelogs.com> writes:
> 
> The ASERTs are coming from GnuTLS itself.  You'll have to raise the
> `gnutls-log-level' to 1 or 0.  The non-fatal retries are probably
> network-related.  We don't have a way, IIRC, to tell the error's
> severity in advance so we always issue it at level 1.  But I have a note
> in gnutls.c:
> 
>       GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
>       /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
> 
> so specifically for GNUTLS_EAGAIN we can go up to level 3.  Could you
> try that change on your own?  See below for suggested patch.  I will
> install if it works for you.
> 
> FP> I'm not sure it is even harmful.
> FP> Any idea what could be wrong there ?
> 
> Not harmful, just annoying :)
> 
> Ted
> 
> === modified file 'src/gnutls.c'
> --- src/gnutls.c        2013-10-17 06:42:21 +0000
> +++ src/gnutls.c        2013-11-03 11:31:16 +0000
>  <at>  <at>  -487,9 +487,13  <at>  <at> 
>      }
>    else
>      {
> +      bool eagain = (err == GNUTLS_E_AGAIN);
> +      int level =  eagain ? 1 : 3;
>        ret = 1;
> -      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
> -      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
> +      GNUTLS_LOG2 (level,
> +                   max_log_level,
> +                   eagain ? "retry:" : "non-fatal error:",
> +                   str);
>      }
> 
>    if (err == GNUTLS_E_WARNING_ALERT_RECEIVED
> 
> 


Thanks for the reply and the patch.
From what I have tested, I can make the following comments:
- if I understand correctly, you want to put EAGAIN at level 3, so you need 
to :

int level = eagain ? 3 : 1;

- GNUTLS_LOG2 is a macro in which string concatenation is used for the third 
argument, so you can't put a ? : instruction there.

So this gives me the following:

@@ -463,9 +487,19 @@
     }
   else
     {
+      bool eagain = (err == GNUTLS_E_AGAIN);
+      int level =  eagain ? 3 : 1;
       ret = 1;
-      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
-      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
+      if (eagain)
+       GNUTLS_LOG2 (level,
+                    max_log_level,
+                    "retry:",
+                    str);
+      else
+       GNUTLS_LOG2 (level,
+                    max_log_level,
+                    "non-fatal error:",
+                    str);
     }

   if (err == GNUTLS_E_WARNING_ALERT_RECEIVED

And now the warning is not issued at level 1.

Best regards,

Fabrice





  reply	other threads:[~2013-11-03 17:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 22:13 Emacs on windows and GnuTLS Fabrice Popineau
2013-11-03 11:33 ` Ted Zlatanov
2013-11-03 17:16   ` Fabrice Popineau [this message]
2013-11-04 16:20     ` Ted Zlatanov
2013-11-05  2:31       ` Ted Zlatanov
2013-11-05 11:59         ` Fabrice Popineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20131103T180731-886@post.gmane.org \
    --to=fabrice.popineau@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).