diff --git a/CHANGELOG.md b/CHANGELOG.md index b2aa4b72..dc92e7a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ HTTP: * Add message::need_eof * Use message::need_eof in example servers +* Use synchronous writes in chunk output example API Changes: diff --git a/test/doc/http_snippets.cpp b/test/doc/http_snippets.cpp index 171488e5..a59a2456 100644 --- a/test/doc/http_snippets.cpp +++ b/test/doc/http_snippets.cpp @@ -180,34 +180,18 @@ void fxx() { // Write the next chunk with the chunk extensions // The implementation will make a copy of the extensions object, // so the caller does not need to manage lifetime issues. - boost::asio::async_write(sock, make_chunk(get_next_chunk_body(), ext), - [](error_code ec, std::size_t) - { - if(ec) - std::cout << "Error: " << ec.message() << std::endl; - }); + boost::asio::write(sock, make_chunk(get_next_chunk_body(), ext)); // Write the next chunk with the chunk extensions // The implementation will make a copy of the extensions object, storing the copy // using the custom allocator, so the caller does not need to manage lifetime issues. - boost::asio::async_write(sock, - make_chunk(get_next_chunk_body(), ext, std::allocator{}), - [](error_code ec, std::size_t) - { - if(ec) - std::cout << "Error: " << ec.message() << std::endl; - }); + boost::asio::write(sock, make_chunk(get_next_chunk_body(), ext, std::allocator{})); // Write the next chunk with the chunk extensions // The implementation allocates memory using the default allocator and takes ownership // of the extensions object, so the caller does not need to manage lifetime issues. // Note: ext is moved - boost::asio::async_write(sock, make_chunk(get_next_chunk_body(), std::move(ext)), - [](error_code ec, std::size_t) - { - if(ec) - std::cout << "Error: " << ec.message() << std::endl; - }); + boost::asio::write(sock, make_chunk(get_next_chunk_body(), std::move(ext))); //] }