diff options
| author | Richard M. Stallman | 1994-04-30 06:05:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-30 06:05:51 +0000 |
| commit | e333e8646bf92525dadc074d466901111e169a91 (patch) | |
| tree | 833ffcdfa88c583e074f402c5563342aff659e96 /src/process.c | |
| parent | b664e4837ebc685962169d2c65cc787c6bf334f3 (diff) | |
| download | emacs-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.c | 22 |
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 | ||
| 2468 | static void | 2477 | static void |
| @@ -2674,7 +2683,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2674 | DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, | 2683 | DEFUN ("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\ |
| 2676 | PROCESS may be a process, a buffer, or the name of a process or buffer.\n\ | 2685 | PROCESS may be a process, a buffer, or the name of a process or buffer.\n\ |
| 2677 | Nil or no arg means current buffer's process.\n\ | 2686 | nil or no arg means current buffer's process.\n\ |
| 2678 | Second arg CURRENT-GROUP non-nil means send signal to\n\ | 2687 | Second arg CURRENT-GROUP non-nil means send signal to\n\ |
| 2679 | the current process-group of the process's controlling terminal\n\ | 2688 | the current process-group of the process's controlling terminal\n\ |
| 2680 | rather than to the process's own process group.\n\ | 2689 | rather 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\ |
| 3191 | Values are nil to use a pipe, and t or 'pty for a pty. Note that if\n\ | 3200 | Values are nil to use a pipe, or t or `pty' to use a pty.\n\ |
| 3192 | pty's are not available, this variable will be ignored. The value takes\n\ | 3201 | The value has no effect if the system has no ptys or if all ptys are busy:\n\ |
| 3193 | effect when `start-process' is called."); | 3202 | then a pipe is used in any case.\n\ |
| 3203 | The 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); |