async_write requires a non-const message:

This is necessary to meet the requirements for
asynchronous operations:

http://www.boost.org/doc/libs/1_64_0/doc/html/boost_asio/reference/asynchronous_operations.html

Specifically, that the caller must ensure the validity of the message
argument until the handler is invoked.

object
This commit is contained in:
Vinnie Falco committed 2017-07-20 08:15:28 -07:00
1 parent 77a4c36aeb
commit bd4d1cbe91
3 files changed
+5 -3

No files matched your search

+2 -2
View File
@@ -359,7 +359,7 @@ class write_msg_op
Body, Fields, no_chunk_decorator> sr;
data(Handler& h, Stream& s_, message<
isRequest, Body, Fields> const& m_)
isRequest, Body, Fields>& m_)
: s(s_)
, sr(m_, no_chunk_decorator{})
{
@@ -766,7 +766,7 @@ template<class AsyncWriteStream,
async_return_type<
WriteHandler, void(error_code)>
async_write(AsyncWriteStream& stream,
message<isRequest, Body, Fields> const& msg,
message<isRequest, Body, Fields>& msg,
WriteHandler&& handler)
{
static_assert(