Commit 426ea716 authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #378 from steve-o/err-handler

Fix #LIBZMQ-329 assertion on WSAEACCES
parents f35bed0e acbb9938
...@@ -217,28 +217,69 @@ void zmq::win_error (char *buffer_, size_t buffer_size_) ...@@ -217,28 +217,69 @@ void zmq::win_error (char *buffer_, size_t buffer_size_)
int zmq::wsa_error_to_errno (int errcode) int zmq::wsa_error_to_errno (int errcode)
{ {
switch (errcode) { switch (errcode) {
case WSAEINPROGRESS: // 10009 - File handle is not valid.
return EAGAIN;
case WSAEBADF: case WSAEBADF:
return EBADF; return EBADF;
// 10013 - Permission denied.
case WSAEACCES:
return EACCES;
// 10014 - Bad address.
case WSAEFAULT:
return EFAULT;
// 10022 - Invalid argument.
case WSAEINVAL: case WSAEINVAL:
return EINVAL; return EINVAL;
// 10024 - Too many open files.
case WSAEMFILE: case WSAEMFILE:
return EMFILE; return EMFILE;
case WSAEFAULT: // 10036 - Operation now in progress.
return EFAULT; case WSAEINPROGRESS:
return EAGAIN;
// 10040 - Message too long.
case WSAEMSGSIZE:
return EMSGSIZE;
// 10043 - Protocol not supported.
case WSAEPROTONOSUPPORT: case WSAEPROTONOSUPPORT:
return EPROTONOSUPPORT; return EPROTONOSUPPORT;
case WSAENOBUFS: // 10047 - Address family not supported by protocol family.
return ENOBUFS; case WSAEAFNOSUPPORT:
case WSAENETDOWN: return EAFNOSUPPORT;
return ENETDOWN; // 10048 - Address already in use.
case WSAEADDRINUSE: case WSAEADDRINUSE:
return EADDRINUSE; return EADDRINUSE;
// 10049 - Cannot assign requested address.
case WSAEADDRNOTAVAIL: case WSAEADDRNOTAVAIL:
return EADDRNOTAVAIL; return EADDRNOTAVAIL;
case WSAEAFNOSUPPORT: // 10050 - Network is down.
return EAFNOSUPPORT; case WSAENETDOWN:
return ENETDOWN;
// 10051 - Network is unreachable.
case WSAENETUNREACH:
return ENETUNREACH;
// 10052 - Network dropped connection on reset.
case WSAENETRESET:
return ENETRESET;
// 10053 - Software caused connection abort.
case WSAECONNABORTED:
return ECONNABORTED;
// 10054 - Connection reset by peer.
case WSAECONNRESET:
return ECONNRESET;
// 10055 - No buffer space available.
case WSAENOBUFS:
return ENOBUFS;
// 10057 - Socket is not connected.
case WSAENOTCONN:
return ENOTCONN;
// 10060 - Connection timed out.
case WSAETIMEDOUT:
return ETIMEDOUT;
// 10061 - Connection refused.
case WSAECONNREFUSED:
return ECONNREFUSED;
// 10065 - No route to host.
case WSAEHOSTUNREACH:
return EHOSTUNREACH;
default: default:
wsa_assert (false); wsa_assert (false);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment