Skip to content

Conversation

@MungoG
Copy link
Collaborator

@MungoG MungoG commented Dec 12, 2025

No description provided.

@MungoG MungoG requested review from ashtum and vinniefalco December 12, 2025 18:58
@cppalliance-bot
Copy link

cppalliance-bot commented Dec 12, 2025

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

@MungoG MungoG force-pushed the issue-55-async-body-write-stream branch from 1823aa8 to e14d19e Compare December 19, 2025 18:26
#ifndef BOOST_BEAST2_IMPL_BODY_WRITE_STREAM_HPP
#define BOOST_BEAST2_IMPL_BODY_WRITE_STREAM_HPP

#include <boost/beast2/detail/config.hpp>
Copy link
Member

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>
Copy link
Member

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);
Copy link
Member

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)
Copy link
Member

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(
Copy link
Member

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;
Copy link
Member

@vinniefalco vinniefalco Dec 19, 2025

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.
Copy link
Member

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);
Copy link
Member

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_;
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants