-
Notifications
You must be signed in to change notification settings - Fork 9
Create body_write_stream (initial work in progress) #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Create body_write_stream (initial work in progress) #119
Conversation
|
An automated preview of the documentation is available at https://119.beast2.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2025-12-19 18:30:53 UTC |
1823aa8 to
e14d19e
Compare
| #ifndef BOOST_BEAST2_IMPL_BODY_WRITE_STREAM_HPP | ||
| #define BOOST_BEAST2_IMPL_BODY_WRITE_STREAM_HPP | ||
|
|
||
| #include <boost/beast2/detail/config.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only public headers need to include config.hpp. since this is always included by a public header, it superfluous.
| #include <boost/asio/coroutine.hpp> | ||
| #include <boost/core/ignore_unused.hpp> | ||
|
|
||
| #include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ewww
| system::error_code ec = {}, | ||
| std::size_t bytes_transferred = 0) | ||
| { | ||
| boost::ignore_unused(bytes_transferred); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better not to ignore it
| operator()( | ||
| Self& self, | ||
| system::error_code ec = {}, | ||
| std::size_t bytes_transferred = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this compile
std::size_t = 0
| // is an AsyncWriteStream, and also static_assert that body_write_stream is too. | ||
|
|
||
| template<class AsyncWriteStream> | ||
| body_write_stream<AsyncWriteStream>::body_write_stream( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please format this way
template<class AsyncWriteStream>
body_write_stream<AsyncWriteStream>::
body_write_stream(
| This will be the type of executor used to invoke completion handlers | ||
| which do not have an explicit associated executor. | ||
| */ | ||
| typedef typename AsyncWriteStream::executor_type executor_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not using ? actually this might be wrong... is executor_type guaranteed to exist? it might be better to use decltype on get_executor() instead. see:
https://original.boost.org/doc/libs/1_89_0/doc/html/boost_asio/reference/AsyncWriteStream.html
| */ | ||
| typedef typename AsyncWriteStream::executor_type executor_type; | ||
|
|
||
| /** Get the executor associated with the object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The brief for functions which return a meaningful value should usually start with the word "Return"
| BOOST_ASIO_INITFN_AUTO_RESULT_TYPE( | ||
| CompletionToken, | ||
| void(system::error_code, std::size_t)) | ||
| async_write_some(ConstBufferSequence mb, CompletionToken&& handler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass the buffer sequence as const&
| private: | ||
| AsyncWriteStream& stream_; | ||
| http_proto::serializer& sr_; | ||
| http_proto::serializer::stream& srs_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right, the user should not have to create serializer::stream and pass it in.
No description provided.