Fix forwarding async operations in buffered streams.

This commit is contained in:
Christopher Kohlhoff 2016-08-20 16:37:03 +10:00
parent 5bebdf6e8c
commit 6c303a2efd
2 changed files with 4 additions and 18 deletions

View File

@ -158,15 +158,8 @@ public:
async_write_some(const ConstBufferSequence& buffers,
ASIO_MOVE_ARG(WriteHandler) handler)
{
async_completion<WriteHandler,
void (asio::error_code, std::size_t)> init(handler);
next_layer_.async_write_some(buffers,
ASIO_MOVE_CAST(ASIO_HANDLER_TYPE(WriteHandler,
void (asio::error_code, std::size_t)))(
init.completion_handler));
return init.result.get();
return next_layer_.async_write_some(buffers,
ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Fill the buffer with some data. Returns the number of bytes placed in the

View File

@ -193,15 +193,8 @@ public:
async_read_some(const MutableBufferSequence& buffers,
ASIO_MOVE_ARG(ReadHandler) handler)
{
async_completion<ReadHandler,
void (asio::error_code, std::size_t)> init(handler);
next_layer_.async_read_some(buffers,
ASIO_MOVE_CAST(ASIO_HANDLER_TYPE(ReadHandler,
void (asio::error_code, std::size_t)))(
init.completion_handler));
return init.result.get();
return next_layer_.async_read_some(buffers,
ASIO_MOVE_CAST(ReadHandler)(handler));
}
/// Peek at the incoming data on the stream. Returns the number of bytes read.