diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d94fff..2d1dbad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Version 106: WebSocket: * websocket test improvements +* Remove obsolete write_op -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/impl/write.ipp b/include/boost/beast/websocket/impl/write.ipp index f8fb5f08..6a55b557 100644 --- a/include/boost/beast/websocket/impl/write.ipp +++ b/include/boost/beast/websocket/impl/write.ipp @@ -510,120 +510,6 @@ upcall: //------------------------------------------------------------------------------ -template -template -class stream::write_op -{ - struct data : op - { - int step = 0; - stream& ws; - consuming_buffers cb; - std::size_t remain; - token tok; - - data(Handler&, stream& ws_, - Buffers const& bs) - : ws(ws_) - , cb(bs) - , remain(boost::asio::buffer_size(cb)) - , tok(ws.t_.unique()) - { - } - }; - - handler_ptr d_; - -public: - write_op(write_op&&) = default; - write_op(write_op const&) = default; - - template - explicit - write_op(DeducedHandler&& h, - stream& ws, Args&&... args) - : d_(std::forward(h), - ws, std::forward(args)...) - { - } - - void operator()(error_code ec); - - friend - void* asio_handler_allocate( - std::size_t size, write_op* op) - { - using boost::asio::asio_handler_allocate; - return asio_handler_allocate( - size, std::addressof(op->d_.handler())); - } - - friend - void asio_handler_deallocate( - void* p, std::size_t size, write_op* op) - { - using boost::asio::asio_handler_deallocate; - asio_handler_deallocate( - p, size, std::addressof(op->d_.handler())); - } - - friend - bool asio_handler_is_continuation(write_op* op) - { - using boost::asio::asio_handler_is_continuation; - return op->d_->step > 2 || - asio_handler_is_continuation( - std::addressof(op->d_.handler())); - } - - template - friend - void asio_handler_invoke(Function&& f, write_op* op) - { - using boost::asio::asio_handler_invoke; - asio_handler_invoke( - f, std::addressof(op->d_.handler())); - } -}; - -template -template -void -stream:: -write_op:: -operator()(error_code ec) -{ - auto& d = *d_; - switch(d.step) - { - case 2: - d.step = 3; - BOOST_BEAST_FALLTHROUGH; - case 3: - case 0: - { - auto const n = d.remain; - d.remain -= n; - auto const fin = d.remain <= 0; - if(fin) - d.step = d.step ? 4 : 1; - else - d.step = d.step ? 3 : 2; - auto const pb = buffer_prefix(n, d.cb); - d.cb.consume(n); - return d.ws.async_write_some( - fin, pb, std::move(*this)); - } - - case 1: - case 4: - break; - } - d_.invoke(ec); -} - -//------------------------------------------------------------------------------ - template template void @@ -916,10 +802,9 @@ async_write( "ConstBufferSequence requirements not met"); async_completion init{handler}; - write_op>{ - init.completion_handler, *this, bs}( - error_code{}); + write_some_op>{init.completion_handler, + *this, true, bs}({}, 0, false); return init.result.get(); }