Return bytes transferred when ReadFile fails with ERROR_MORE_DATA. Reverted the previous change to ignore ERROR_MORE_DATA. Instead, the error will propagated as with any other (i.e. in an error_code or thrown as a system_error). For code that needs to handle partial messages, the error_code overload should be used.
diff --git a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp index 1281050..cf0d3a6 100644 --- a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp +++ b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp
@@ -440,19 +440,16 @@ if (!ok) { DWORD last_error = ::GetLastError(); - if (last_error != ERROR_MORE_DATA) + if (last_error == ERROR_HANDLE_EOF) { - if (last_error == ERROR_HANDLE_EOF) - { - ec = asio::error::eof; - } - else - { - ec = asio::error_code(last_error, - asio::error::get_system_category()); - } + ec = asio::error::eof; } - return 0; + else + { + ec = asio::error_code(last_error, + asio::error::get_system_category()); + } + return (last_error == ERROR_MORE_DATA) ? bytes_transferred : 0; } ec = asio::error_code();