Patch from Mato that fixes a subtle connect bug: EAGAIN was being used as a translation value for EINPROGRESS, thus

shadowing a real EAGAIN return value from the OS.  This caused later
assertions of "Invalid argument" in stream_engine.cpp when it attempted to
use a socket which was not connected.

I also add EINTR to mean EINPROGRESS, as per the POSIX and FreeBSD
documentation which specifies that a connect() call interrupted due to a
signal will complete asynchronously.

Signed-off-by: Martin Lucina <martin@lucina.net>
This commit is contained in:
Ian Barber
2012-05-03 13:24:12 +01:00
parent f497aae8df
commit 1075005b50
2 changed files with 13 additions and 5 deletions

View File

@@ -186,6 +186,13 @@ int zmq::ipc_connecter_t::open ()
// Connect was successfull immediately.
if (rc == 0)
return 0;
// Translate other error codes indicating asynchronous connect has been
// launched to a uniform EINPROGRESS.
if (rc == -1 && errno == EINTR) {
errno = EINPROGRESS;
return -1;
}
// Forward the error.
return -1;