]> code.delx.au - gnu-emacs/commitdiff
Simplify the DNS resolution loop a bit
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 16 Feb 2016 02:58:26 +0000 (13:58 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 16 Feb 2016 02:58:26 +0000 (13:58 +1100)
* src/process.c (wait_reading_process_output): Simplify the
DNS resolution loop a bit.

src/process.c

index fec2f5a7ee423ea2b53e9a15417e617f2c25d5c1..9a3bcaed389674acc77ebefd9f5553d1083ee00e 100644 (file)
@@ -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 */