emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] feature/async-dns c43bb7f 2/3: Simplify the DNS resolution


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] feature/async-dns c43bb7f 2/3: Simplify the DNS resolution loop a bit
Date: Tue, 16 Feb 2016 04:57:24 +0000

branch: feature/async-dns
commit c43bb7f136ab9e9439a4b5c045040a12cbe8bda0
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Simplify the DNS resolution loop a bit
    
    * src/process.c (wait_reading_process_output): Simplify the
    DNS resolution loop a bit.
---
 src/process.c |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/src/process.c b/src/process.c
index fec2f5a..9a3bcae 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4883,38 +4883,23 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
 
 #ifdef HAVE_GETADDRINFO_A
       {
-       Lisp_Object ip_addresses, answers = Qnil, answer;
-       Lisp_Object process_list_head, async_dns_process_candidate;
+       Lisp_Object ip_addresses;
+       Lisp_Object process_list_head, aproc;
        struct Lisp_Process *p;
 
-       /* This is programmed in a somewhat awkward fashion because
-          calling connect_network_socket might make us end up back
-          here again, and we would have a race condition with
-          segfaults.  So first go through all pending requests and see
-          whether we got any answers. */
-       FOR_EACH_PROCESS(process_list_head, async_dns_process_candidate)
+       FOR_EACH_PROCESS(process_list_head, aproc)
          {
-           p = XPROCESS (async_dns_process_candidate);
+           p = XPROCESS (aproc);
 
-           if (p->dns_requests)
+           if (p->dns_requests &&
+               (! wait_proc || p == wait_proc))
              {
-               if (! wait_proc || p == wait_proc)
-                 {
-                   ip_addresses = check_for_dns (async_dns_process_candidate);
-                   if (!EQ (ip_addresses, Qt))
-                     answers = Fcons (Fcons (async_dns_process_candidate, 
ip_addresses), answers);
-                 }
+               ip_addresses = check_for_dns (aproc);
+               if (!NILP (ip_addresses) &&
+                   !EQ (ip_addresses, Qt))
+                 connect_network_socket (aproc, ip_addresses);
              }
          }
-       /* Then continue the connection for the successful
-          requests. */
-       while (!NILP (answers))
-         {
-           answer = XCAR (answers);
-           answers = XCDR (answers);
-           if (!NILP (XCDR (answer)))
-             connect_network_socket (XCAR (answer), XCDR (answer));
-         }
       }
 #endif /* HAVE_GETADDRINFO_A */
 



reply via email to

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