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