Mercurial > emacs
comparison src/process.c @ 107546:59e2de1eaab1
* process.c (Fmake_network_process): Don't apply Bug#5173 fix for Windows.
| author | Chong Yidong <cyd@stupidchicken.com> |
|---|---|
| date | Fri, 26 Mar 2010 20:45:32 -0400 |
| parents | 805495d3c451 |
| children | 98f7a4103e8e |
comparison
equal
deleted
inserted
replaced
| 107545:805495d3c451 | 107546:59e2de1eaab1 |
|---|---|
| 3532 | 3532 |
| 3533 for (lres = res; lres; lres = lres->ai_next) | 3533 for (lres = res; lres; lres = lres->ai_next) |
| 3534 { | 3534 { |
| 3535 int optn, optbits; | 3535 int optn, optbits; |
| 3536 | 3536 |
| 3537 retry_connect: | |
| 3538 | |
| 3537 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); | 3539 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); |
| 3538 if (s < 0) | 3540 if (s < 0) |
| 3539 { | 3541 { |
| 3540 xerrno = errno; | 3542 xerrno = errno; |
| 3541 continue; | 3543 continue; |
| 3634 if (is_non_blocking_client && xerrno == EWOULDBLOCK) | 3636 if (is_non_blocking_client && xerrno == EWOULDBLOCK) |
| 3635 break; | 3637 break; |
| 3636 #endif | 3638 #endif |
| 3637 #endif | 3639 #endif |
| 3638 #endif | 3640 #endif |
| 3641 | |
| 3642 #ifndef WINDOWSNT | |
| 3639 if (xerrno == EINTR) | 3643 if (xerrno == EINTR) |
| 3640 { | 3644 { |
| 3641 /* Unlike most other syscalls connect() cannot be called | 3645 /* Unlike most other syscalls connect() cannot be called |
| 3642 again. (That would return EALREADY.) The proper way to | 3646 again. (That would return EALREADY.) The proper way to |
| 3643 wait for completion is select(). */ | 3647 wait for completion is select(). */ |
| 3644 int sc; | 3648 int sc, len; |
| 3645 SELECT_TYPE fdset; | 3649 SELECT_TYPE fdset; |
| 3646 retry_select: | 3650 retry_select: |
| 3647 FD_ZERO (&fdset); | 3651 FD_ZERO (&fdset); |
| 3648 FD_SET (s, &fdset); | 3652 FD_SET (s, &fdset); |
| 3649 QUIT; | 3653 QUIT; |
| 3650 sc = select (s + 1, (SELECT_TYPE *)0, &fdset, (SELECT_TYPE *)0, | 3654 sc = select (s + 1, (SELECT_TYPE *)0, &fdset, (SELECT_TYPE *)0, |
| 3651 (EMACS_TIME *)0); | 3655 (EMACS_TIME *)0); |
| 3652 if (sc == -1) | 3656 if (sc == -1) |
| 3653 { | 3657 { |
| 3654 if (errno == EINTR) | 3658 if (errno == EINTR) |
| 3655 goto retry_select; | 3659 goto retry_select; |
| 3656 else | 3660 else |
| 3657 report_file_error ("select failed", Qnil); | 3661 report_file_error ("select failed", Qnil); |
| 3658 } | 3662 } |
| 3659 eassert (sc > 0); | 3663 eassert (sc > 0); |
| 3660 { | 3664 |
| 3661 int len = sizeof xerrno; | 3665 len = sizeof xerrno; |
| 3662 eassert (FD_ISSET (s, &fdset)); | 3666 eassert (FD_ISSET (s, &fdset)); |
| 3663 if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) | 3667 if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) |
| 3664 report_file_error ("getsockopt failed", Qnil); | 3668 report_file_error ("getsockopt failed", Qnil); |
| 3665 if (xerrno != 0) | 3669 if (xerrno) |
| 3666 errno = xerrno, report_file_error ("error during connect", Qnil); | 3670 errno = xerrno, report_file_error ("error during connect", Qnil); |
| 3667 else | 3671 else |
| 3668 break; | 3672 break; |
| 3669 } | 3673 } |
| 3670 } | 3674 #endif /* !WINDOWSNT */ |
| 3671 | 3675 |
| 3672 immediate_quit = 0; | 3676 immediate_quit = 0; |
| 3673 | 3677 |
| 3674 /* Discard the unwind protect closing S. */ | 3678 /* Discard the unwind protect closing S. */ |
| 3675 specpdl_ptr = specpdl + count1; | 3679 specpdl_ptr = specpdl + count1; |
| 3676 emacs_close (s); | 3680 emacs_close (s); |
| 3677 s = -1; | 3681 s = -1; |
| 3682 | |
| 3683 #ifdef WINDOWSNT | |
| 3684 if (xerrno == EINTR) | |
| 3685 goto retry_connect; | |
| 3686 #endif | |
| 3678 } | 3687 } |
| 3679 | 3688 |
| 3680 if (s >= 0) | 3689 if (s >= 0) |
| 3681 { | 3690 { |
| 3682 #ifdef DATAGRAM_SOCKETS | 3691 #ifdef DATAGRAM_SOCKETS |
