Return correct number of bytes transferred when datagram truncation occurs.

This commit is contained in:
Zyrin 2019-01-28 15:42:23 +01:00 committed by Christopher Kohlhoff
parent 3b0daafa0b
commit 555ed6c993

View File

@ -771,7 +771,7 @@ signed_size_type recv(socket_type s, buf* bufs, size_t count,
else if (ec.value() == ERROR_PORT_UNREACHABLE)
ec = asio::error::connection_refused;
else if (ec.value() == WSAEMSGSIZE || ec.value() == ERROR_MORE_DATA)
ec.assign(0, ec.category());
result = 0;
if (result != 0)
return socket_error_retval;
ec = asio::error_code();
@ -925,7 +925,7 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count,
else if (ec.value() == ERROR_PORT_UNREACHABLE)
ec = asio::error::connection_refused;
else if (ec.value() == WSAEMSGSIZE || ec.value() == ERROR_MORE_DATA)
ec.assign(0, ec.category());
result = 0;
if (result != 0)
return socket_error_retval;
ec = asio::error_code();