Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
49387874
Commit
49387874
authored
May 08, 2011
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Async connect doesn't fail on EWSANETDOWN
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
da1ef4d2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
58 deletions
+76
-58
err.cpp
src/err.cpp
+59
-53
err.hpp
src/err.hpp
+12
-0
tcp_connecter.cpp
src/tcp_connecter.cpp
+5
-5
No files found.
src/err.cpp
View file @
49387874
...
...
@@ -66,119 +66,125 @@ const char *zmq::errno_to_string (int errno_)
const
char
*
zmq
::
wsa_error
()
{
int
errcode
=
WSAGetLastError
();
int
no
=
WSAGetLastError
();
// TODO: This is not a generic way to handle this...
if
(
errcode
==
WSAEWOULDBLOCK
)
if
(
no
==
WSAEWOULDBLOCK
)
return
NULL
;
return
wsa_error_no
(
no
);
}
const
char
*
zmq
::
wsa_error_no
(
int
no_
)
{
// TODO: It seems that list of Windows socket errors is longer than this.
// Investigate whether there's a way to convert it into the string
// automatically (wsaError->HRESULT->string?).
return
(
errcode
==
WSABASEERR
)
?
(
no_
==
WSABASEERR
)
?
"No Error"
:
(
errcode
==
WSAEINTR
)
?
(
no_
==
WSAEINTR
)
?
"Interrupted system call"
:
(
errcode
==
WSAEBADF
)
?
(
no_
==
WSAEBADF
)
?
"Bad file number"
:
(
errcode
==
WSAEACCES
)
?
(
no_
==
WSAEACCES
)
?
"Permission denied"
:
(
errcode
==
WSAEFAULT
)
?
(
no_
==
WSAEFAULT
)
?
"Bad address"
:
(
errcode
==
WSAEINVAL
)
?
(
no_
==
WSAEINVAL
)
?
"Invalid argument"
:
(
errcode
==
WSAEMFILE
)
?
(
no_
==
WSAEMFILE
)
?
"Too many open files"
:
(
errcode
==
WSAEWOULDBLOCK
)
?
(
no_
==
WSAEWOULDBLOCK
)
?
"Operation would block"
:
(
errcode
==
WSAEINPROGRESS
)
?
(
no_
==
WSAEINPROGRESS
)
?
"Operation now in progress"
:
(
errcode
==
WSAEALREADY
)
?
(
no_
==
WSAEALREADY
)
?
"Operation already in progress"
:
(
errcode
==
WSAENOTSOCK
)
?
(
no_
==
WSAENOTSOCK
)
?
"Socket operation on non-socket"
:
(
errcode
==
WSAEDESTADDRREQ
)
?
(
no_
==
WSAEDESTADDRREQ
)
?
"Destination address required"
:
(
errcode
==
WSAEMSGSIZE
)
?
(
no_
==
WSAEMSGSIZE
)
?
"Message too long"
:
(
errcode
==
WSAEPROTOTYPE
)
?
(
no_
==
WSAEPROTOTYPE
)
?
"Protocol wrong type for socket"
:
(
errcode
==
WSAENOPROTOOPT
)
?
(
no_
==
WSAENOPROTOOPT
)
?
"Bad protocol option"
:
(
errcode
==
WSAEPROTONOSUPPORT
)
?
(
no_
==
WSAEPROTONOSUPPORT
)
?
"Protocol not supported"
:
(
errcode
==
WSAESOCKTNOSUPPORT
)
?
(
no_
==
WSAESOCKTNOSUPPORT
)
?
"Socket type not supported"
:
(
errcode
==
WSAEOPNOTSUPP
)
?
(
no_
==
WSAEOPNOTSUPP
)
?
"Operation not supported on socket"
:
(
errcode
==
WSAEPFNOSUPPORT
)
?
(
no_
==
WSAEPFNOSUPPORT
)
?
"Protocol family not supported"
:
(
errcode
==
WSAEAFNOSUPPORT
)
?
(
no_
==
WSAEAFNOSUPPORT
)
?
"Address family not supported by protocol family"
:
(
errcode
==
WSAEADDRINUSE
)
?
(
no_
==
WSAEADDRINUSE
)
?
"Address already in use"
:
(
errcode
==
WSAEADDRNOTAVAIL
)
?
(
no_
==
WSAEADDRNOTAVAIL
)
?
"Can't assign requested address"
:
(
errcode
==
WSAENETDOWN
)
?
(
no_
==
WSAENETDOWN
)
?
"Network is down"
:
(
errcode
==
WSAENETUNREACH
)
?
(
no_
==
WSAENETUNREACH
)
?
"Network is unreachable"
:
(
errcode
==
WSAENETRESET
)
?
(
no_
==
WSAENETRESET
)
?
"Net dropped connection or reset"
:
(
errcode
==
WSAECONNABORTED
)
?
(
no_
==
WSAECONNABORTED
)
?
"Software caused connection abort"
:
(
errcode
==
WSAECONNRESET
)
?
(
no_
==
WSAECONNRESET
)
?
"Connection reset by peer"
:
(
errcode
==
WSAENOBUFS
)
?
(
no_
==
WSAENOBUFS
)
?
"No buffer space available"
:
(
errcode
==
WSAEISCONN
)
?
(
no_
==
WSAEISCONN
)
?
"Socket is already connected"
:
(
errcode
==
WSAENOTCONN
)
?
(
no_
==
WSAENOTCONN
)
?
"Socket is not connected"
:
(
errcode
==
WSAESHUTDOWN
)
?
(
no_
==
WSAESHUTDOWN
)
?
"Can't send after socket shutdown"
:
(
errcode
==
WSAETOOMANYREFS
)
?
(
no_
==
WSAETOOMANYREFS
)
?
"Too many references can't splice"
:
(
errcode
==
WSAETIMEDOUT
)
?
(
no_
==
WSAETIMEDOUT
)
?
"Connection timed out"
:
(
errcode
==
WSAECONNREFUSED
)
?
(
no_
==
WSAECONNREFUSED
)
?
"Connection refused"
:
(
errcode
==
WSAELOOP
)
?
(
no_
==
WSAELOOP
)
?
"Too many levels of symbolic links"
:
(
errcode
==
WSAENAMETOOLONG
)
?
(
no_
==
WSAENAMETOOLONG
)
?
"File name too long"
:
(
errcode
==
WSAEHOSTDOWN
)
?
(
no_
==
WSAEHOSTDOWN
)
?
"Host is down"
:
(
errcode
==
WSAEHOSTUNREACH
)
?
(
no_
==
WSAEHOSTUNREACH
)
?
"No Route to Host"
:
(
errcode
==
WSAENOTEMPTY
)
?
(
no_
==
WSAENOTEMPTY
)
?
"Directory not empty"
:
(
errcode
==
WSAEPROCLIM
)
?
(
no_
==
WSAEPROCLIM
)
?
"Too many processes"
:
(
errcode
==
WSAEUSERS
)
?
(
no_
==
WSAEUSERS
)
?
"Too many users"
:
(
errcode
==
WSAEDQUOT
)
?
(
no_
==
WSAEDQUOT
)
?
"Disc Quota Exceeded"
:
(
errcode
==
WSAESTALE
)
?
(
no_
==
WSAESTALE
)
?
"Stale NFS file handle"
:
(
errcode
==
WSAEREMOTE
)
?
(
no_
==
WSAEREMOTE
)
?
"Too many levels of remote in path"
:
(
errcode
==
WSASYSNOTREADY
)
?
(
no_
==
WSASYSNOTREADY
)
?
"Network SubSystem is unavailable"
:
(
errcode
==
WSAVERNOTSUPPORTED
)
?
(
no_
==
WSAVERNOTSUPPORTED
)
?
"WINSOCK DLL Version out of range"
:
(
errcode
==
WSANOTINITIALISED
)
?
(
no_
==
WSANOTINITIALISED
)
?
"Successful WSASTARTUP not yet performed"
:
(
errcode
==
WSAHOST_NOT_FOUND
)
?
(
no_
==
WSAHOST_NOT_FOUND
)
?
"Host not found"
:
(
errcode
==
WSATRY_AGAIN
)
?
(
no_
==
WSATRY_AGAIN
)
?
"Non-Authoritative Host not found"
:
(
errcode
==
WSANO_RECOVERY
)
?
(
no_
==
WSANO_RECOVERY
)
?
"Non-Recoverable errors: FORMERR REFUSED NOTIMP"
:
(
errcode
==
WSANO_DATA
)
?
(
no_
==
WSANO_DATA
)
?
"Valid name no data record of requested"
:
"error not defined"
;
}
void
zmq
::
win_error
(
char
*
buffer_
,
size_t
buffer_size_
)
{
DWORD
errcode
=
GetLastError
();
...
...
src/err.hpp
View file @
49387874
...
...
@@ -49,6 +49,7 @@ namespace zmq
namespace
zmq
{
const
char
*
wsa_error
();
const
char
*
wsa_error_no
(
int
no_
);
void
win_error
(
char
*
buffer_
,
size_t
buffer_size_
);
void
wsa_error_to_errno
();
}
...
...
@@ -66,6 +67,17 @@ namespace zmq
}\
} while (false)
// Provides convenient way to assert on WSA-style errors on Windows.
#define wsa_assert_no(no) \
do {\
const char *errstr = zmq::wsa_error_no (no);\
if (errstr != NULL) {\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
__FILE__, __LINE__);\
abort ();\
}\
} while (false)
// Provides convenient way to check GetLastError-style errors on Windows.
#define win_assert(x) \
do {\
...
...
src/tcp_connecter.cpp
View file @
49387874
...
...
@@ -116,12 +116,12 @@ zmq::fd_t zmq::tcp_connecter_t::connect ()
// Assert that the error was caused by the networking problems
// rather than 0MQ bug.
errno
=
err
;
errno_assert
(
errno
==
WSAECONNREFUSED
||
errno
==
WSAETIMEDOUT
||
errno
==
WSAECONNABORTED
||
errno
==
WSAEHOSTUNREACH
||
errno
==
WSAENETUNREACH
)
;
if
(
err
==
WSAECONNREFUSED
||
err
==
WSAETIMEDOUT
||
err
==
WSAECONNABORTED
||
err
==
WSAEHOSTUNREACH
||
err
==
WSAENETUNREACH
||
err
==
WSAENETDOWN
)
return
retired_fd
;
return
retired_fd
;
wsa_assert_no
(
err
)
;
}
// Return the newly connected socket.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment