Map ERROR_PORT_UNREACHABLE to WSAECONNREFUSED.
This commit is contained in:
parent
7472a7e10a
commit
bdf9394467
@ -551,6 +551,8 @@ public:
|
||||
DWORD last_error = ::WSAGetLastError();
|
||||
if (last_error == ERROR_NETNAME_DELETED)
|
||||
last_error = WSAECONNRESET;
|
||||
else if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
last_error = WSAECONNREFUSED;
|
||||
ec = asio::error_code(last_error, asio::native_ecat);
|
||||
return 0;
|
||||
}
|
||||
@ -601,7 +603,7 @@ public:
|
||||
}
|
||||
#endif // defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
|
||||
// Map ERROR_NETNAME_DELETED to more useful error.
|
||||
// Map non-portable errors to their portable counterparts.
|
||||
if (last_error == ERROR_NETNAME_DELETED)
|
||||
{
|
||||
if (handler_op->cancel_token_.expired())
|
||||
@ -609,6 +611,10 @@ public:
|
||||
else
|
||||
last_error = WSAECONNRESET;
|
||||
}
|
||||
else if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
{
|
||||
last_error = WSAECONNREFUSED;
|
||||
}
|
||||
|
||||
// Make a copy of the handler so that the memory can be deallocated before
|
||||
// the upcall is made.
|
||||
@ -727,6 +733,8 @@ public:
|
||||
if (result != 0)
|
||||
{
|
||||
DWORD last_error = ::WSAGetLastError();
|
||||
if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
last_error = WSAECONNREFUSED;
|
||||
ec = asio::error_code(last_error, asio::native_ecat);
|
||||
return 0;
|
||||
}
|
||||
@ -775,6 +783,12 @@ public:
|
||||
}
|
||||
#endif // defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
|
||||
// Map non-portable errors to their portable counterparts.
|
||||
if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
{
|
||||
last_error = WSAECONNREFUSED;
|
||||
}
|
||||
|
||||
// Make a copy of the handler so that the memory can be deallocated before
|
||||
// the upcall is made.
|
||||
Handler handler(handler_op->handler_);
|
||||
@ -889,6 +903,8 @@ public:
|
||||
DWORD last_error = ::WSAGetLastError();
|
||||
if (last_error == ERROR_NETNAME_DELETED)
|
||||
last_error = WSAECONNRESET;
|
||||
else if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
last_error = WSAECONNREFUSED;
|
||||
ec = asio::error_code(last_error, asio::native_ecat);
|
||||
return 0;
|
||||
}
|
||||
@ -944,7 +960,7 @@ public:
|
||||
}
|
||||
#endif // defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
|
||||
// Map ERROR_NETNAME_DELETED to more useful error.
|
||||
// Map non-portable errors to their portable counterparts.
|
||||
if (last_error == ERROR_NETNAME_DELETED)
|
||||
{
|
||||
if (handler_op->cancel_token_.expired())
|
||||
@ -952,6 +968,10 @@ public:
|
||||
else
|
||||
last_error = WSAECONNRESET;
|
||||
}
|
||||
else if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
{
|
||||
last_error = WSAECONNREFUSED;
|
||||
}
|
||||
|
||||
// Check for connection closed.
|
||||
else if (last_error == 0 && bytes_transferred == 0)
|
||||
@ -1075,6 +1095,8 @@ public:
|
||||
if (result != 0)
|
||||
{
|
||||
DWORD last_error = ::WSAGetLastError();
|
||||
if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
last_error = WSAECONNREFUSED;
|
||||
ec = asio::error_code(last_error, asio::native_ecat);
|
||||
return 0;
|
||||
}
|
||||
@ -1138,6 +1160,12 @@ public:
|
||||
}
|
||||
#endif // defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
|
||||
// Map non-portable errors to their portable counterparts.
|
||||
if (last_error == ERROR_PORT_UNREACHABLE)
|
||||
{
|
||||
last_error = WSAECONNREFUSED;
|
||||
}
|
||||
|
||||
// Check for connection closed.
|
||||
if (last_error == 0 && bytes_transferred == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user