emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114956: Several GnuTLS fixes for log level and init


From: Teodor Zlatanov
Subject: [Emacs-diffs] trunk r114956: Several GnuTLS fixes for log level and initialization.
Date: Tue, 05 Nov 2013 02:28:36 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114956
revision-id: address@hidden
parent: address@hidden
committer: Ted Zlatanov <address@hidden>
branch nick: quickfixes
timestamp: Mon 2013-11-04 21:29:03 -0500
message:
  Several GnuTLS fixes for log level and initialization.
  
  * gnutls.c (emacs_gnutls_handle_error): Adjust log level for EAGAIN.
  (Fgnutls_boot): Set process gnutls_p later, after initialization.
  
  * process.c (wait_reading_process_output, read_process_output)
  (send_process): Check gnutls_state is not NULL.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/gnutls.c                   gnutls.c-20100926054902-dzayyj6wycit6kzn-3
  src/process.c                  process.c-20091113204419-o5vbwnq5f7feedwu-462
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-11-04 17:57:17 +0000
+++ b/src/ChangeLog     2013-11-05 02:29:03 +0000
@@ -1,3 +1,11 @@
+2013-11-05  Teodor Zlatanov  <address@hidden>
+
+       * process.c (wait_reading_process_output, read_process_output)
+       (send_process): Check gnutls_state is not NULL.
+
+       * gnutls.c (emacs_gnutls_handle_error): Adjust log level for EAGAIN.
+       (Fgnutls_boot): Set process gnutls_p later, after initialization.
+
 2013-11-04  Jan Djärv  <address@hidden>
 
        * nsterm.m (init, run, stop:): New methods in EmacsApp for

=== modified file 'src/gnutls.c'
--- a/src/gnutls.c      2013-11-04 06:09:03 +0000
+++ b/src/gnutls.c      2013-11-05 02:29:03 +0000
@@ -488,8 +488,20 @@
   else
     {
       ret = 1;
-      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
-      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
+
+      switch (err)
+        {
+        case GNUTLS_E_AGAIN:
+          GNUTLS_LOG2 (3,
+                       max_log_level,
+                       "retry:",
+                       str);
+        default:
+          GNUTLS_LOG2 (1,
+                       max_log_level,
+                       "non-fatal error:",
+                       str);
+        }
     }
 
   if (err == GNUTLS_E_WARNING_ALERT_RECEIVED
@@ -810,7 +822,6 @@
   c_hostname = SSDATA (hostname);
 
   state = XPROCESS (proc)->gnutls_state;
-  XPROCESS (proc)->gnutls_p = 1;
 
   if (TYPE_RANGED_INTEGERP (int, loglevel))
     {
@@ -833,7 +844,6 @@
   emacs_gnutls_deinit (proc);
 
   /* Mark PROC as a GnuTLS process.  */
-  XPROCESS (proc)->gnutls_p = 1;
   XPROCESS (proc)->gnutls_state = NULL;
   XPROCESS (proc)->gnutls_x509_cred = NULL;
   XPROCESS (proc)->gnutls_anon_cred = NULL;
@@ -1093,6 +1103,9 @@
       fn_gnutls_x509_crt_deinit (gnutls_verify_cert);
     }
 
+  // Only set this flag if the whole initialization succeeded.
+  XPROCESS (proc)->gnutls_p = 1;
+
   return gnutls_make_error (ret);
 }
 

=== modified file 'src/process.c'
--- a/src/process.c     2013-11-04 06:09:03 +0000
+++ b/src/process.c     2013-11-05 02:29:03 +0000
@@ -4609,7 +4609,7 @@
                      {
                        struct Lisp_Process *p =
                          XPROCESS (chan_process[channel]);
-                       if (p && p->gnutls_p && p->infd
+                       if (p && p->gnutls_p && p->gnutls_state && p->infd
                            && ((emacs_gnutls_record_check_pending
                                 (p->gnutls_state))
                                > 0))
@@ -4623,6 +4623,7 @@
                {
                  /* Check this specific channel. */
                  if (wait_proc->gnutls_p /* Check for valid process.  */
+                      && p->gnutls_state
                      /* Do we have pending data?  */
                      && ((emacs_gnutls_record_check_pending
                           (wait_proc->gnutls_state))
@@ -5004,7 +5005,7 @@
          proc_buffered_char[channel] = -1;
        }
 #ifdef HAVE_GNUTLS
-      if (p->gnutls_p)
+      if (p->gnutls_p && p->gnutls_state)
        nbytes = emacs_gnutls_read (p, chars + carryover + buffered,
                                    readmax - buffered);
       else
@@ -5498,7 +5499,7 @@
 #endif
            {
 #ifdef HAVE_GNUTLS
-             if (p->gnutls_p)
+             if (p->gnutls_p && p->gnutls_state)
                written = emacs_gnutls_write (p, cur_buf, cur_len);
              else
 #endif


reply via email to

[Prev in Thread] Current Thread [Next in Thread]