Mercurial > emacs
comparison src/process.c @ 58072:4ebc52bf6429
(Fmake_network_process): Remove kludge for interrupted
connects on BSD. If connect is interrupted, just close socket and
start over rather than sleeping and retry with same socket.
| author | Kim F. Storm <storm@cua.dk> |
|---|---|
| date | Tue, 09 Nov 2004 09:40:37 +0000 |
| parents | 8abbe69dfdb2 |
| children | bcfa2be2012e |
comparison
equal
deleted
inserted
replaced
| 58071:253aa382ba57 | 58072:4ebc52bf6429 |
|---|---|
| 3021 | 3021 |
| 3022 for (lres = res; lres; lres = lres->ai_next) | 3022 for (lres = res; lres; lres = lres->ai_next) |
| 3023 { | 3023 { |
| 3024 int optn, optbits; | 3024 int optn, optbits; |
| 3025 | 3025 |
| 3026 retry_connect: | |
| 3027 | |
| 3026 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); | 3028 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); |
| 3027 if (s < 0) | 3029 if (s < 0) |
| 3028 { | 3030 { |
| 3029 xerrno = errno; | 3031 xerrno = errno; |
| 3030 continue; | 3032 continue; |
| 3099 report_file_error ("Cannot listen on server socket", Qnil); | 3101 report_file_error ("Cannot listen on server socket", Qnil); |
| 3100 | 3102 |
| 3101 break; | 3103 break; |
| 3102 } | 3104 } |
| 3103 | 3105 |
| 3104 retry_connect: | |
| 3105 | |
| 3106 immediate_quit = 1; | 3106 immediate_quit = 1; |
| 3107 QUIT; | 3107 QUIT; |
| 3108 | 3108 |
| 3109 /* This turns off all alarm-based interrupts; the | 3109 /* This turns off all alarm-based interrupts; the |
| 3110 bind_polling_period call above doesn't always turn all the | 3110 bind_polling_period call above doesn't always turn all the |
| 3142 #endif | 3142 #endif |
| 3143 #endif | 3143 #endif |
| 3144 | 3144 |
| 3145 immediate_quit = 0; | 3145 immediate_quit = 0; |
| 3146 | 3146 |
| 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. */ | 3147 /* Discard the unwind protect closing S. */ |
| 3160 specpdl_ptr = specpdl + count1; | 3148 specpdl_ptr = specpdl + count1; |
| 3161 emacs_close (s); | 3149 emacs_close (s); |
| 3162 s = -1; | 3150 s = -1; |
| 3151 | |
| 3152 if (xerrno == EINTR) | |
| 3153 goto retry_connect; | |
| 3163 } | 3154 } |
| 3164 | 3155 |
| 3165 if (s >= 0) | 3156 if (s >= 0) |
| 3166 { | 3157 { |
| 3167 #ifdef DATAGRAM_SOCKETS | 3158 #ifdef DATAGRAM_SOCKETS |
