emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111857: Don't call 'select' from ema


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111857: Don't call 'select' from emacs_gnutls_pull.
Date: Fri, 22 Feb 2013 18:00:14 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111857
author: Claudio Bley <address@hidden>
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2013-02-22 18:00:14 +0200
message:
  Don't call 'select' from emacs_gnutls_pull.
  
   src/w32.c (emacs_gnutls_pull): Don't call 'select', and don't loop.
   This avoids warning messages reported as part of Bug#13546.
modified:
  src/ChangeLog
  src/w32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-02-21 02:35:33 +0000
+++ b/src/ChangeLog     2013-02-22 16:00:14 +0000
@@ -1,3 +1,8 @@
+2013-02-22  Claudio Bley  <address@hidden>
+
+       * w32.c (emacs_gnutls_pull): Don't call 'select', and don't loop.
+       This avoids warning messages reported as part of Bug#13546.
+
 2013-02-21  Ken Brown  <address@hidden>
 
        * sheap.c (report_sheap_usage): Fix arguments of message1_no_log.

=== modified file 'src/w32.c'
--- a/src/w32.c 2013-02-16 14:16:07 +0000
+++ b/src/w32.c 2013-02-22 16:00:14 +0000
@@ -7822,47 +7822,26 @@
 ssize_t
 emacs_gnutls_pull (gnutls_transport_ptr_t p, void* buf, size_t sz)
 {
-  int n, sc, err;
+  int n, err;
   SELECT_TYPE fdset;
   EMACS_TIME timeout;
   struct Lisp_Process *process = (struct Lisp_Process *)p;
   int fd = process->infd;
 
-  for (;;)
-    {
-      n = sys_read (fd, (char*)buf, sz);
-
-      if (n >= 0)
-        return n;
-
-      err = errno;
-
-      if (err == EWOULDBLOCK)
-        {
-          /* Set a small timeout.  */
-         timeout = make_emacs_time (1, 0);
-          FD_ZERO (&fdset);
-          FD_SET ((int)fd, &fdset);
-
-          /* Use select with the timeout to poll the selector.  */
-          sc = select (fd + 1, &fdset, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
-                       &timeout, NULL);
-
-          if (sc > 0)
-            continue;  /* Try again.  */
-
-          /* Translate the WSAEWOULDBLOCK alias EWOULDBLOCK to EAGAIN.
-             Also accept select return 0 as an indicator to EAGAIN.  */
-          if (sc == 0 || errno == EWOULDBLOCK)
-            err = EAGAIN;
-          else
-            err = errno; /* Other errors are just passed on.  */
-        }
-
-      emacs_gnutls_transport_set_errno (process->gnutls_state, err);
-
-      return -1;
-    }
+  n = sys_read (fd, (char*)buf, sz);
+
+  if (n >= 0)
+    return n;
+
+  err = errno;
+
+  /* Translate the WSAEWOULDBLOCK alias EWOULDBLOCK to EAGAIN. */
+  if (err == EWOULDBLOCK)
+    err = EAGAIN;
+
+  emacs_gnutls_transport_set_errno (process->gnutls_state, err);
+
+  return -1;
 }
 
 ssize_t


reply via email to

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