Add asio_handler_invoke overloads for stream algorithms:

fix #1012

This fixes a bug where asynchronous stream alogrithms do not
work correctly with the legacy `io_service::strand` implementation.
This commit is contained in:
Vinnie Falco committed 2018-03-01 08:31:57 -08:00
1 parent 2543dbe5b9
commit 726118468b
27 files changed
+483 -5

No files matched your search

+28
View File
@@ -10,6 +10,9 @@
// Test that header file is self-contained.
#include <boost/beast/websocket/stream.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/strand.hpp>
#include "test.hpp"
namespace boost {
@@ -641,6 +644,31 @@ public:
move_only_handler{});
}
struct copyable_handler
{
template<class... Args>
void
operator()(Args&&...) const
{
}
};
void
testAsioHandlerInvoke()
{
// make sure things compile, also can set a
// breakpoint in asio_handler_invoke to make sure
// it is instantiated.
{
boost::asio::io_context ioc;
boost::asio::io_service::strand s{ioc};
stream<test::stream> ws{ioc};
flat_buffer b;
ws.async_write(boost::asio::const_buffer{},
s.wrap(copyable_handler{}));
}
}
void
run() override
{