diff options
| author | Lars Ingebrigtsen | 2016-02-16 13:58:26 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-02-16 13:58:26 +1100 |
| commit | c43bb7f136ab9e9439a4b5c045040a12cbe8bda0 (patch) | |
| tree | 212bf73a9c93763bd875b932f1e86cd79f3100de /src/process.c | |
| parent | d1fc5a548e5b49df40b0a8dad1f962cd01593da4 (diff) | |
| download | emacs-c43bb7f136ab9e9439a4b5c045040a12cbe8bda0.tar.gz emacs-c43bb7f136ab9e9439a4b5c045040a12cbe8bda0.zip | |
Simplify the DNS resolution loop a bit
* src/process.c (wait_reading_process_output): Simplify the
DNS resolution loop a bit.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/process.c b/src/process.c index fec2f5a7ee4..9a3bcaed389 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, | |||
| 4883 | 4883 | ||
| 4884 | #ifdef HAVE_GETADDRINFO_A | 4884 | #ifdef HAVE_GETADDRINFO_A |
| 4885 | { | 4885 | { |
| 4886 | Lisp_Object ip_addresses, answers = Qnil, answer; | 4886 | Lisp_Object ip_addresses; |
| 4887 | Lisp_Object process_list_head, async_dns_process_candidate; | 4887 | Lisp_Object process_list_head, aproc; |
| 4888 | struct Lisp_Process *p; | 4888 | struct Lisp_Process *p; |
| 4889 | 4889 | ||
| 4890 | /* This is programmed in a somewhat awkward fashion because | 4890 | FOR_EACH_PROCESS(process_list_head, aproc) |
| 4891 | calling connect_network_socket might make us end up back | ||
| 4892 | here again, and we would have a race condition with | ||
| 4893 | segfaults. So first go through all pending requests and see | ||
| 4894 | whether we got any answers. */ | ||
| 4895 | FOR_EACH_PROCESS(process_list_head, async_dns_process_candidate) | ||
| 4896 | { | 4891 | { |
| 4897 | p = XPROCESS (async_dns_process_candidate); | 4892 | p = XPROCESS (aproc); |
| 4898 | 4893 | ||
| 4899 | if (p->dns_requests) | 4894 | if (p->dns_requests && |
| 4895 | (! wait_proc || p == wait_proc)) | ||
| 4900 | { | 4896 | { |
| 4901 | if (! wait_proc || p == wait_proc) | 4897 | ip_addresses = check_for_dns (aproc); |
| 4902 | { | 4898 | if (!NILP (ip_addresses) && |
| 4903 | ip_addresses = check_for_dns (async_dns_process_candidate); | 4899 | !EQ (ip_addresses, Qt)) |
| 4904 | if (!EQ (ip_addresses, Qt)) | 4900 | connect_network_socket (aproc, ip_addresses); |
| 4905 | answers = Fcons (Fcons (async_dns_process_candidate, ip_addresses), answers); | ||
| 4906 | } | ||
| 4907 | } | 4901 | } |
| 4908 | } | 4902 | } |
| 4909 | /* Then continue the connection for the successful | ||
| 4910 | requests. */ | ||
| 4911 | while (!NILP (answers)) | ||
| 4912 | { | ||
| 4913 | answer = XCAR (answers); | ||
| 4914 | answers = XCDR (answers); | ||
| 4915 | if (!NILP (XCDR (answer))) | ||
| 4916 | connect_network_socket (XCAR (answer), XCDR (answer)); | ||
| 4917 | } | ||
| 4918 | } | 4903 | } |
| 4919 | #endif /* HAVE_GETADDRINFO_A */ | 4904 | #endif /* HAVE_GETADDRINFO_A */ |
| 4920 | 4905 | ||