summaryrefslogtreecommitdiff
path: root/src/tcp_connecter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tcp_connecter.cpp')
-rw-r--r--src/tcp_connecter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp
index de105bb..5ae01e7 100644
--- a/src/tcp_connecter.cpp
+++ b/src/tcp_connecter.cpp
@@ -140,7 +140,7 @@ void xs::tcp_connecter_t::start_connecting ()
}
// Connection establishment may be delayed. Poll for its completion.
- else if (rc == -1 && errno == EAGAIN) {
+ else if (rc == -1 && errno == EINPROGRESS) {
xs_assert (!handle);
handle = add_fd (s);
set_pollout (handle);
@@ -236,17 +236,18 @@ int xs::tcp_connecter_t::open ()
if (rc == 0)
return 0;
- // Asynchronous connect was launched.
+ // Translate other error codes indicating asynchronous connect has been
+ // launched to a uniform EINPROGRESS.
#ifdef XS_HAVE_WINDOWS
if (rc == SOCKET_ERROR && (WSAGetLastError () == WSAEINPROGRESS ||
WSAGetLastError () == WSAEWOULDBLOCK)) {
- errno = EAGAIN;
+ errno = EINPROGRESS;
return -1;
}
wsa_error_to_errno ();
#else
- if (rc == -1 && errno == EINPROGRESS) {
- errno = EAGAIN;
+ if (rc == -1 && errno == EINTR) {
+ errno = EINPROGRESS;
return -1;
}
#endif