Repository navigation
fix: on COROSIO, the public headers include nothing of Boost.Asio - #52
Merged
Merged
Conversation
Since Boost.HTTP replaced Beast (#46), what still brought Asio into a program on COROSIO was anyhttp's own buffers: Reader::read_some() and Writer::write()/write_eof() took Asio's, and corosio/runtime.hpp included <boost/asio/buffer.hpp> and capy's bridge for the io:: helpers. The runtime layer now names its buffers, ConstBuffer and MutableBuffer, Asio's on ASIO and capy's on COROSIO, and make_buffer() makes either: boost::asio::buffer() or capy::make_buffer(). The coroutines of Reader and Writer take them, and convert to Asio's for the backends, which are written in those as before. So on COROSIO, write_eof() takes a capy buffer, and read_some() a capy buffer or sequence; the overloads for Asio's buffer sequences are ASIO's only. The io:: stream helpers, which take Asio's buffers, move from runtime.hpp to net.hpp, which is not public. Code that builds with either runtime makes its buffers with make_buffer(): the request handlers, the shared tests, the docs and the programs. Capy's buffers have no operator+, so that code writes buffer += n. A COROSIO tree compiles every public header on its own into test_all, and fails if one of them defines BOOST_ASIO_VERSION; CoroutineApi ends a body with capy's buffers, spelled as capy does. Fixes #39. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39: on COROSIO, no public header includes anything of Boost.Asio any more.
Since Boost.HTTP replaced Beast (#46), anyhttp's own buffers were the only thing still bringing Asio into a COROSIO program.
Reader::read_some(),Writer::write()andWriter::write_eof()took Asio's buffers, andcorosio/runtime.hppincluded<boost/asio/buffer.hpp>and capy's Asio bridge for theio::helpers.What changes
ConstBufferandMutableBufferare Asio's on ASIO and capy's on COROSIO.make_buffer()makes either one:boost::asio::buffer()on ASIO,boost::capy::make_buffer()on COROSIO.write_eof()takes a capy buffer, andread_some()takes a capy buffer or a capy buffer sequence. The overloads for Asio's buffer sequences are now ASIO-only. Nothing changes on ASIO: the aliases are the types the API had before.io::stream helpers moved (read_some,write,peek,receive,wait_readable). They take Asio's buffers, so they went from{asio,corosio}/runtime.hppinto{asio,corosio}/net.hpp, which aren't public. The code itself is unchanged.make_buffer(): the request handlers, the shared tests, the docs snippets and examples,client_main, the README andtest/package/consumer.cpp. Capy's buffers have nooperator+, so that code writesbuffer += ninstead ofbuffer + n. The docs and CLAUDE.md say so.Tests
The issue asks for two; both are in:
test_allon its own, in a file of its own (test/CMakeLists.txt), and fails with#errorifBOOST_ASIO_VERSIONis defined. The public headers are the onescmake/install.cmakeinstalls, minusasio/andcorosio/. I checked that the check fails when Asio is included.CoroutineApi.WHEN_ending_a_body_with_a_capy_buffer_THEN_the_peer_gets_all_of_it(COROSIO only) ends a body withwrite_eof(boost::capy::make_buffer(...)). It reads into a sequence of capy buffers and spells them the way capy does, not throughmake_buffer().Run locally:
gtest-parallelis green onbuild/(626 tests),build-corosio/(591) andbuild-h2v2/. OneExternalTLS.h2load/HTTP2failure in an earlierbuild/run passed when run alone and on the rerun.build-corosio-gcc/fails onlyClientAsync.Recursion×3, which fails there onmastertoo.build-gcc/builds; I didn't run its suite.scripts/check_package.shpasses: install, embed-asio and embed-corosio.build-corosio/.docstarget builds.Open
Writer::write_eof()takes one capy buffer on COROSIO, not a buffer sequence. A sequence version would have to write all but the last buffer before ending the body. I left it out because nothing needs it yet.🤖 Generated with Claude Code