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
2017-06-21 11:50:50 -07:00
parent 77a4c36aeb
commit bd4d1cbe91
3 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,8 @@ Version 64:
* Simplify websocket write_op * Simplify websocket write_op
* Exemplars are compiled code * Exemplars are compiled code
* Better User-Agent in examples * Better User-Agent in examples
* async_write requires a non-const message
* Doc tidying
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

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

View File

@ -488,7 +488,7 @@ template<class AsyncWriteStream,
async_return_type< async_return_type<
WriteHandler, void(error_code)> WriteHandler, void(error_code)>
async_write(AsyncWriteStream& stream, async_write(AsyncWriteStream& stream,
message<isRequest, Body, Fields> const& msg, message<isRequest, Body, Fields>& msg,
WriteHandler&& handler); WriteHandler&& handler);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------