Commit d1fc5a54 authored by Alain Schneble's avatar Alain Schneble Committed by Lars Ingebrigtsen

Loop over the process list instead of maintaining a separate list

* src/process.c: Remove declaration/definition of dns_processes list.
* src/process.c (wait_reading_process_output): Loop over all processes in
Vprocess_alist instead of dns_processes, to check for completed DNS
parent 9755b753
......@@ -282,8 +282,6 @@ static int max_input_desc;
/* Indexed by descriptor, gives the process (if any) for that descriptor. */
static Lisp_Object chan_process[FD_SETSIZE];
/* Pending DNS requests. */
static Lisp_Object dns_processes;
static void wait_for_socket_fds (Lisp_Object process, char *name);
......@@ -3959,7 +3957,6 @@ usage: (make-network-process &rest ARGS) */)
p->dns_requests = dns_requests;
p->status = Qconnect;
dns_processes = Fcons (proc, dns_processes);
......@@ -4885,10 +4882,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
if (!NILP (dns_processes))
Lisp_Object dns_list = dns_processes, dns, ip_addresses,
answers = Qnil, answer, new = Qnil;
Lisp_Object ip_addresses, answers = Qnil, answer;
Lisp_Object process_list_head, async_dns_process_candidate;
struct Lisp_Process *p;
/* This is programmed in a somewhat awkward fashion because
......@@ -4896,30 +4892,20 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
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. */
while (!NILP (dns_list))
FOR_EACH_PROCESS(process_list_head, async_dns_process_candidate)
dns = XCAR (dns_list);
dns_list = XCDR (dns_list);
p = XPROCESS (dns);
if (p && p->dns_requests)
p = XPROCESS (async_dns_process_candidate);
if (p->dns_requests)
if (! wait_proc || p == wait_proc)
ip_addresses = check_for_dns (dns);
if (EQ (ip_addresses, Qt))
new = Fcons (dns, new);
answers = Fcons (Fcons (dns, ip_addresses), answers);
ip_addresses = check_for_dns (async_dns_process_candidate);
if (!EQ (ip_addresses, Qt))
answers = Fcons (Fcons (async_dns_process_candidate, ip_addresses), answers);
new = Fcons (dns, new);
/* Replace with the list of DNS requests still not responded
to. */
dns_processes = new;
/* Then continue the connection for the successful
requests. */
while (!NILP (answers))
......@@ -7811,9 +7797,6 @@ init_process_emacs (void)
memset (datagram_address, 0, sizeof datagram_address);
dns_processes = Qnil;
#if defined (DARWIN_OS)
/* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
......@@ -7901,9 +7884,6 @@ syms_of_process (void)
staticpro (&Vprocess_alist);
staticpro (&deleted_pid_list);
staticpro (&dns_processes);
#endif /* subprocesses */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment