diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/process.c b/src/process.c index db6e85c0fb3..65dec1457b0 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2722,7 +2722,6 @@ usage: (make-network-process &rest ARGS) */) | |||
| 2722 | int xerrno = 0; | 2722 | int xerrno = 0; |
| 2723 | int s = -1, outch, inch; | 2723 | int s = -1, outch, inch; |
| 2724 | struct gcpro gcpro1; | 2724 | struct gcpro gcpro1; |
| 2725 | int retry = 0; | ||
| 2726 | int count = SPECPDL_INDEX (); | 2725 | int count = SPECPDL_INDEX (); |
| 2727 | int count1; | 2726 | int count1; |
| 2728 | Lisp_Object QCaddress; /* one of QClocal or QCremote */ | 2727 | Lisp_Object QCaddress; /* one of QClocal or QCremote */ |
| @@ -3023,6 +3022,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3023 | { | 3022 | { |
| 3024 | int optn, optbits; | 3023 | int optn, optbits; |
| 3025 | 3024 | ||
| 3025 | retry_connect: | ||
| 3026 | |||
| 3026 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); | 3027 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); |
| 3027 | if (s < 0) | 3028 | if (s < 0) |
| 3028 | { | 3029 | { |
| @@ -3101,8 +3102,6 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3101 | break; | 3102 | break; |
| 3102 | } | 3103 | } |
| 3103 | 3104 | ||
| 3104 | retry_connect: | ||
| 3105 | |||
| 3106 | immediate_quit = 1; | 3105 | immediate_quit = 1; |
| 3107 | QUIT; | 3106 | QUIT; |
| 3108 | 3107 | ||
| @@ -3144,22 +3143,13 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3144 | 3143 | ||
| 3145 | immediate_quit = 0; | 3144 | immediate_quit = 0; |
| 3146 | 3145 | ||
| 3147 | if (xerrno == EINTR) | ||
| 3148 | goto retry_connect; | ||
| 3149 | if (xerrno == EADDRINUSE && retry < 20) | ||
| 3150 | { | ||
| 3151 | /* A delay here is needed on some FreeBSD systems, | ||
| 3152 | and it is harmless, since this retrying takes time anyway | ||
| 3153 | and should be infrequent. */ | ||
| 3154 | Fsleep_for (make_number (1), Qnil); | ||
| 3155 | retry++; | ||
| 3156 | goto retry_connect; | ||
| 3157 | } | ||
| 3158 | |||
| 3159 | /* Discard the unwind protect closing S. */ | 3146 | /* Discard the unwind protect closing S. */ |
| 3160 | specpdl_ptr = specpdl + count1; | 3147 | specpdl_ptr = specpdl + count1; |
| 3161 | emacs_close (s); | 3148 | emacs_close (s); |
| 3162 | s = -1; | 3149 | s = -1; |
| 3150 | |||
| 3151 | if (xerrno == EINTR) | ||
| 3152 | goto retry_connect; | ||
| 3163 | } | 3153 | } |
| 3164 | 3154 | ||
| 3165 | if (s >= 0) | 3155 | if (s >= 0) |