aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-30 06:05:51 +0000
committerRichard M. Stallman1994-04-30 06:05:51 +0000
commite333e8646bf92525dadc074d466901111e169a91 (patch)
tree833ffcdfa88c583e074f402c5563342aff659e96 /src/process.c
parentb664e4837ebc685962169d2c65cc787c6bf334f3 (diff)
downloademacs-e333e8646bf92525dadc074d466901111e169a91.tar.gz
emacs-e333e8646bf92525dadc074d466901111e169a91.zip
(Fopen_network_stream): Retry the connect if EADDRINUSE. Ignore EISCONN.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c
index 8b7b0dd46d0..dfe8d2f0bcb 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1482,6 +1482,7 @@ Fourth arg SERVICE is name of the service desired, or an integer\n\
1482 int port; 1482 int port;
1483 struct hostent host_info_fixed; 1483 struct hostent host_info_fixed;
1484 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1484 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1485 int retry = 0;
1485 1486
1486 GCPRO4 (name, buffer, host, service); 1487 GCPRO4 (name, buffer, host, service);
1487 CHECK_STRING (name, 0); 1488 CHECK_STRING (name, 0);
@@ -1541,11 +1542,19 @@ Fourth arg SERVICE is name of the service desired, or an integer\n\
1541 unrequest_sigio (); 1542 unrequest_sigio ();
1542 1543
1543 loop: 1544 loop:
1544 if (connect (s, (struct sockaddr *) &address, sizeof address) == -1) 1545 if (connect (s, (struct sockaddr *) &address, sizeof address) == -1
1546 && errno != EISCONN)
1545 { 1547 {
1546 int xerrno = errno; 1548 int xerrno = errno;
1549
1547 if (errno == EINTR) 1550 if (errno == EINTR)
1548 goto loop; 1551 goto loop;
1552 if (errno == EADDRINUSE && retry < 20)
1553 {
1554 retry++;
1555 goto loop;
1556 }
1557
1549 close (s); 1558 close (s);
1550 1559
1551 if (interrupt_input) 1560 if (interrupt_input)
@@ -2462,7 +2471,7 @@ Output from processes can arrive in between bunches.")
2462 right away. 2471 right away.
2463 2472
2464 If we can, we try to signal PROCESS by sending control characters 2473 If we can, we try to signal PROCESS by sending control characters
2465 down the pipe. This allows us to signal inferiors who have changed 2474 down the pty. This allows us to signal inferiors who have changed
2466 their uid, for which killpg would return an EPERM error. */ 2475 their uid, for which killpg would return an EPERM error. */
2467 2476
2468static void 2477static void
@@ -2674,7 +2683,7 @@ process_send_signal (process, signo, current_group, nomsg)
2674DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, 2683DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0,
2675 "Interrupt process PROCESS. May be process or name of one.\n\ 2684 "Interrupt process PROCESS. May be process or name of one.\n\
2676PROCESS may be a process, a buffer, or the name of a process or buffer.\n\ 2685PROCESS may be a process, a buffer, or the name of a process or buffer.\n\
2677Nil or no arg means current buffer's process.\n\ 2686nil or no arg means current buffer's process.\n\
2678Second arg CURRENT-GROUP non-nil means send signal to\n\ 2687Second arg CURRENT-GROUP non-nil means send signal to\n\
2679the current process-group of the process's controlling terminal\n\ 2688the current process-group of the process's controlling terminal\n\
2680rather than to the process's own process group.\n\ 2689rather than to the process's own process group.\n\
@@ -3188,9 +3197,10 @@ nil means don't delete them until `list-processes' is run.");
3188 3197
3189 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type, 3198 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type,
3190 "Control type of device used to communicate with subprocesses.\n\ 3199 "Control type of device used to communicate with subprocesses.\n\
3191Values are nil to use a pipe, and t or 'pty for a pty. Note that if\n\ 3200Values are nil to use a pipe, or t or `pty' to use a pty.\n\
3192pty's are not available, this variable will be ignored. The value takes\n\ 3201The value has no effect if the system has no ptys or if all ptys are busy:\n\
3193effect when `start-process' is called."); 3202then a pipe is used in any case.\n\
3203The value takes effect when `start-process' is called.");
3194 Vprocess_connection_type = Qt; 3204 Vprocess_connection_type = Qt;
3195 3205
3196 defsubr (&Sprocessp); 3206 defsubr (&Sprocessp);