aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen2016-02-15 16:05:14 +1100
committerLars Ingebrigtsen2016-02-15 16:05:14 +1100
commit40155283c380a795c1a0036a31e1b41ed1df0f38 (patch)
tree2224216352a254fd571fc086e6bf07435e18f817 /src/process.c
parent204847702b925b5e2377a0a12278308657674af7 (diff)
downloademacs-40155283c380a795c1a0036a31e1b41ed1df0f38.tar.gz
emacs-40155283c380a795c1a0036a31e1b41ed1df0f38.zip
Remove some #ifdefs and update documentation
* doc/lispref/processes.texi (Network Processes): Remove mention of `dns'. * lisp/net/network-stream.el (open-network-stream): Remove mention of `dns'. * src/process.c (Fset_process_filter) (Fset_process_window_size, Fprocess_contact) (Fprocess_datagram_address, Fset_process_datagram_address) (Fset_network_process_option, Fprocess_send_region) (Fprocess_send_string, Fset_process_coding_system) (Fset_process_filter_multibyte): Remove the #ifdef HAVE_GETADDRINFO_A checks. (Fprocess_send_string): Wait for TLS negotiation. (wait_for_tls_negotiation): New function. (send_process): Remove the TLS boot check. * src/process.c (Fmake_network_process): Ditto.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c73
1 files changed, 25 insertions, 48 deletions
diff --git a/src/process.c b/src/process.c
index 5acf31550ef..1dd52742e16 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1031,10 +1031,8 @@ The string argument is normally a multibyte string, except:
1031 1031
1032 CHECK_PROCESS (process); 1032 CHECK_PROCESS (process);
1033 1033
1034#ifdef HAVE_GETADDRINFO_A
1035 if (NETCONN_P (process)) 1034 if (NETCONN_P (process))
1036 wait_for_socket_fds (process); 1035 wait_for_socket_fds (process);
1037#endif
1038 1036
1039 p = XPROCESS (process); 1037 p = XPROCESS (process);
1040 1038
@@ -1120,10 +1118,8 @@ DEFUN ("set-process-window-size", Fset_process_window_size,
1120{ 1118{
1121 CHECK_PROCESS (process); 1119 CHECK_PROCESS (process);
1122 1120
1123#ifdef HAVE_GETADDRINFO_A
1124 if (NETCONN_P (process)) 1121 if (NETCONN_P (process))
1125 wait_for_socket_fds (process); 1122 wait_for_socket_fds (process);
1126#endif
1127 1123
1128 /* All known platforms store window sizes as 'unsigned short'. */ 1124 /* All known platforms store window sizes as 'unsigned short'. */
1129 CHECK_RANGED_INTEGER (height, 0, USHRT_MAX); 1125 CHECK_RANGED_INTEGER (height, 0, USHRT_MAX);
@@ -1207,10 +1203,8 @@ list of keywords. */)
1207 1203
1208#ifdef DATAGRAM_SOCKETS 1204#ifdef DATAGRAM_SOCKETS
1209 1205
1210#ifdef HAVE_GETADDRINFO_A
1211 if (NETCONN_P (process)) 1206 if (NETCONN_P (process))
1212 wait_for_socket_fds (process); 1207 wait_for_socket_fds (process);
1213#endif
1214 1208
1215 if (DATAGRAM_CONN_P (process) 1209 if (DATAGRAM_CONN_P (process)
1216 && (EQ (key, Qt) || EQ (key, QCremote))) 1210 && (EQ (key, Qt) || EQ (key, QCremote)))
@@ -2441,10 +2435,8 @@ DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_
2441 2435
2442 CHECK_PROCESS (process); 2436 CHECK_PROCESS (process);
2443 2437
2444#ifdef HAVE_GETADDRINFO_A
2445 if (NETCONN_P (process)) 2438 if (NETCONN_P (process))
2446 wait_for_socket_fds (process); 2439 wait_for_socket_fds (process);
2447#endif
2448 2440
2449 if (!DATAGRAM_CONN_P (process)) 2441 if (!DATAGRAM_CONN_P (process))
2450 return Qnil; 2442 return Qnil;
@@ -2465,10 +2457,8 @@ Returns nil upon error setting address, ADDRESS otherwise. */)
2465 2457
2466 CHECK_PROCESS (process); 2458 CHECK_PROCESS (process);
2467 2459
2468#ifdef HAVE_GETADDRINFO_A
2469 if (NETCONN_P (process)) 2460 if (NETCONN_P (process))
2470 wait_for_socket_fds (process); 2461 wait_for_socket_fds (process);
2471#endif
2472 2462
2473 if (!DATAGRAM_CONN_P (process)) 2463 if (!DATAGRAM_CONN_P (process))
2474 return Qnil; 2464 return Qnil;
@@ -2638,9 +2628,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2638 if (!NETCONN1_P (p)) 2628 if (!NETCONN1_P (p))
2639 error ("Process is not a network process"); 2629 error ("Process is not a network process");
2640 2630
2641#ifdef HAVE_GETADDRINFO_A
2642 wait_for_socket_fds (process); 2631 wait_for_socket_fds (process);
2643#endif
2644 2632
2645 s = p->infd; 2633 s = p->infd;
2646 if (s < 0) 2634 if (s < 0)
@@ -3453,16 +3441,12 @@ system used for both reading and writing for this process. If CODING
3453is a cons (DECODING . ENCODING), DECODING is used for reading, and 3441is a cons (DECODING . ENCODING), DECODING is used for reading, and
3454ENCODING is used for writing. 3442ENCODING is used for writing.
3455 3443
3456:nowait NOWAIT -- If NOWAIT is non-nil for a stream type client 3444:nowait BOOL -- If NOWAIT is non-nil for a stream type client
3457process, return without waiting for the connection to complete; 3445process, return without waiting for the connection to complete;
3458instead, the sentinel function will be called with second arg matching 3446instead, the sentinel function will be called with second arg matching
3459"open" (if successful) or "failed" when the connect completes. 3447"open" (if successful) or "failed" when the connect completes.
3460Default is to use a blocking connect (i.e. wait) for stream type 3448Default is to use a blocking connect (i.e. wait) for stream type
3461connections. If NOWAIT is `dns', also do the DNS lookup 3449connections.
3462asynchronously, if supported. In that case, the process is returned
3463before a connection has been made, and the client should not try
3464communicating with the process until it has changed status to
3465"connected".
3466 3450
3467:noquery BOOL -- Query the user unless BOOL is non-nil, and process is 3451:noquery BOOL -- Query the user unless BOOL is non-nil, and process is
3468running when Emacs is exited. 3452running when Emacs is exited.
@@ -3725,7 +3709,7 @@ usage: (make-network-process &rest ARGS) */)
3725#endif 3709#endif
3726 3710
3727#ifdef HAVE_GETADDRINFO_A 3711#ifdef HAVE_GETADDRINFO_A
3728 if (EQ (Fplist_get (contact, QCnowait), Qt) && 3712 if (!NILP (Fplist_get (contact, QCnowait)) &&
3729 !NILP (host)) 3713 !NILP (host))
3730 { 3714 {
3731 int ret; 3715 int ret;
@@ -4683,24 +4667,32 @@ check_for_dns (Lisp_Object proc)
4683 return ip_addresses; 4667 return ip_addresses;
4684} 4668}
4685 4669
4670#endif /* HAVE_GETADDRINFO_A */
4671
4686static void 4672static void
4687wait_for_socket_fds(Lisp_Object process) 4673wait_for_socket_fds (Lisp_Object process)
4688{ 4674{
4689 while (XPROCESS(process)->dns_requests) 4675 while (XPROCESS (process)->infd < 0 &&
4690 { 4676 EQ (XPROCESS (process)->status, Qconnect))
4691 wait_reading_process_output (0, 20 * 1000 * 1000, 0, 0, Qnil, NULL, 0); 4677 wait_reading_process_output (0, 20 * 1000 * 1000, 0, 0, Qnil, NULL, 0);
4692 }
4693} 4678}
4694 4679
4695static void 4680static void
4696wait_while_connecting(Lisp_Object process) 4681wait_while_connecting (Lisp_Object process)
4697{ 4682{
4698 while (EQ (Qconnect, XPROCESS(process)->status)) 4683 while (EQ (XPROCESS (process)->status, Qconnect))
4699 { 4684 wait_reading_process_output (0, 20 * 1000 * 1000, 0, 0, Qnil, NULL, 0);
4700 wait_reading_process_output (0, 20 * 1000 * 1000, 0, 0, Qnil, NULL, 0); 4685}
4701 } 4686
4687static void
4688wait_for_tls_negotiation (Lisp_Object process)
4689{
4690#ifdef HAVE_GNUTLS
4691 while (EQ (XPROCESS (process)->status, Qrun) &&
4692 !NILP (XPROCESS (process)->gnutls_boot_parameters))
4693 wait_reading_process_output (0, 20 * 1000 * 1000, 0, 0, Qnil, NULL, 0);
4694#endif
4702} 4695}
4703#endif /* HAVE_GETADDRINFO_A */
4704 4696
4705/* This variable is different from waiting_for_input in keyboard.c. 4697/* This variable is different from waiting_for_input in keyboard.c.
4706 It is used to communicate to a lisp process-filter/sentinel (via the 4698 It is used to communicate to a lisp process-filter/sentinel (via the
@@ -5962,13 +5954,6 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
5962 if (p->outfd < 0) 5954 if (p->outfd < 0)
5963 error ("Output file descriptor of %s is closed", SDATA (p->name)); 5955 error ("Output file descriptor of %s is closed", SDATA (p->name));
5964 5956
5965#ifdef HAVE_GNUTLS
5966 /* The TLS connection hasn't been set up yet, so we can't write
5967 anything on the socket. */
5968 if (!NILP (p->gnutls_boot_parameters))
5969 return;
5970#endif
5971
5972 coding = proc_encode_coding_system[p->outfd]; 5957 coding = proc_encode_coding_system[p->outfd];
5973 Vlast_coding_system_used = CODING_ID_NAME (coding->id); 5958 Vlast_coding_system_used = CODING_ID_NAME (coding->id);
5974 5959
@@ -6193,10 +6178,8 @@ Output from processes can arrive in between bunches. */)
6193 if (XINT (start) < GPT && XINT (end) > GPT) 6178 if (XINT (start) < GPT && XINT (end) > GPT)
6194 move_gap_both (XINT (start), start_byte); 6179 move_gap_both (XINT (start), start_byte);
6195 6180
6196#ifdef HAVE_GETADDRINFO_A
6197 if (NETCONN_P (proc)) 6181 if (NETCONN_P (proc))
6198 wait_while_connecting (proc); 6182 wait_while_connecting (proc);
6199#endif
6200 6183
6201 send_process (proc, (char *) BYTE_POS_ADDR (start_byte), 6184 send_process (proc, (char *) BYTE_POS_ADDR (start_byte),
6202 end_byte - start_byte, Fcurrent_buffer ()); 6185 end_byte - start_byte, Fcurrent_buffer ());
@@ -6218,10 +6201,10 @@ Output from processes can arrive in between bunches. */)
6218 CHECK_STRING (string); 6201 CHECK_STRING (string);
6219 proc = get_process (process); 6202 proc = get_process (process);
6220 6203
6221#ifdef HAVE_GETADDRINFO_A 6204 if (NETCONN_P (proc)) {
6222 if (NETCONN_P (proc))
6223 wait_while_connecting (proc); 6205 wait_while_connecting (proc);
6224#endif 6206 wait_for_tls_negotiation (proc);
6207 }
6225 6208
6226 send_process (proc, SSDATA (string), 6209 send_process (proc, SSDATA (string),
6227 SBYTES (string), string); 6210 SBYTES (string), string);
@@ -6639,10 +6622,8 @@ process has been transmitted to the serial port. */)
6639 6622
6640 proc = get_process (process); 6623 proc = get_process (process);
6641 6624
6642#ifdef HAVE_GETADDRINFO_A
6643 if (NETCONN_P (proc)) 6625 if (NETCONN_P (proc))
6644 wait_while_connecting (proc); 6626 wait_while_connecting (proc);
6645#endif
6646 6627
6647 if (DATAGRAM_CONN_P (proc)) 6628 if (DATAGRAM_CONN_P (proc))
6648 return process; 6629 return process;
@@ -7099,10 +7080,8 @@ encode subprocess input. */)
7099 7080
7100 CHECK_PROCESS (process); 7081 CHECK_PROCESS (process);
7101 7082
7102#ifdef HAVE_GETADDRINFO_A
7103 if (NETCONN_P (process)) 7083 if (NETCONN_P (process))
7104 wait_for_socket_fds (process); 7084 wait_for_socket_fds (process);
7105#endif
7106 7085
7107 p = XPROCESS (process); 7086 p = XPROCESS (process);
7108 7087
@@ -7143,10 +7122,8 @@ suppressed. */)
7143 7122
7144 CHECK_PROCESS (process); 7123 CHECK_PROCESS (process);
7145 7124
7146#ifdef HAVE_GETADDRINFO_A
7147 if (NETCONN_P (process)) 7125 if (NETCONN_P (process))
7148 wait_for_socket_fds (process); 7126 wait_for_socket_fds (process);
7149#endif
7150 7127
7151 p = XPROCESS (process); 7128 p = XPROCESS (process);
7152 if (NILP (flag)) 7129 if (NILP (flag))