emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106464: Fix asynchrounous GnuTLS soc


From: Lars Magne Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106464: Fix asynchrounous GnuTLS socket handling on some versions of the GnuTLS library.
Date: Mon, 21 Nov 2011 19:21:42 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106464
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Mon 2011-11-21 19:21:42 +0100
message:
  Fix asynchrounous GnuTLS socket handling on some versions of the GnuTLS 
library.
  
  Some versions of the GnuTLS library doesn't respons to poll reliably.
  Work around this by checking all GnuTLS sockets explicitly from the
  idle loop.
modified:
  src/ChangeLog
  src/process.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-11-21 18:01:04 +0000
+++ b/src/ChangeLog     2011-11-21 18:21:42 +0000
@@ -1,3 +1,8 @@
+2011-11-21  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * process.c (wait_reading_process_output): Fix asynchrounous
+       GnuTLS socket handling on some versions of the GnuTLS library.
+
 2011-11-21  Jan Djärv  <address@hidden>
 
        * xterm.c (x_clear_frame): Reinstate the XClearWindow call.

=== modified file 'src/process.c'
--- a/src/process.c     2011-11-20 02:29:42 +0000
+++ b/src/process.c     2011-11-21 18:21:42 +0000
@@ -4620,15 +4620,39 @@
              some data in the TCP buffers so that select works, but
              with custom pull/push functions we need to check if some
              data is available in the buffers manually.  */
-          if (nfds == 0 &&
-              wait_proc && wait_proc->gnutls_p /* Check for valid process.  */
-              /* Do we have pending data?  */
-              && emacs_gnutls_record_check_pending (wait_proc->gnutls_state) > 
0)
-          {
-              nfds = 1;
-              /* Set to Available.  */
-              FD_SET (wait_proc->infd, &Available);
-          }
+          if (nfds == 0)
+           {
+             if (! wait_proc)
+               {
+                 /* We're not waiting on a specific process, so loop
+                    through all the channels and check for data. */
+                 struct Lisp_Process *proc;
+                 for (channel = 0; channel < MAXDESC; ++channel)
+                   {
+                     if (! NILP (chan_process[channel]) &&
+                         (proc = XPROCESS (chan_process[channel])) != NULL &&
+                         proc->gnutls_p &&
+                         proc->infd &&
+                         emacs_gnutls_record_check_pending 
(proc->gnutls_state) > 0)
+                       {
+                         nfds++;
+                         FD_SET (proc->infd, &Available);
+                       }
+                   }
+               }
+             else
+               {
+                 /* Check this specific channel. */
+                 if (wait_proc->gnutls_p && /* Check for valid process.  */
+                     /* Do we have pending data?  */
+                     emacs_gnutls_record_check_pending 
(wait_proc->gnutls_state) > 0)
+                   {
+                     nfds = 1;
+                     /* Set to Available.  */
+                     FD_SET (wait_proc->infd, &Available);
+                   }
+               }
+           }
 #endif
        }
 


reply via email to

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