Pausation abandoning test

Check if paused operations are correctly abandoned when the
ExecutionContext shuts down.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2018-12-08 00:10:10 +01:00
committed by Vinnie Falco
parent 031e13c253
commit 72a99c43a7
2 changed files with 34 additions and 0 deletions

View File

@ -2,6 +2,7 @@ Version 223:
* Add test::stream::service
* Add websocket service
* Pausation abandoning test
--------------------------------------------------------------------------------

View File

@ -262,6 +262,38 @@ public:
});
}
void
testPausationAbandoning()
{
struct test_op
{
std::shared_ptr<stream<test::stream>> s_;
void operator()(
boost::system::error_code = {},
std::size_t = 0)
{
BEAST_FAIL();
}
};
std::weak_ptr<stream<test::stream>> weak_ws;
{
echo_server es{log};
net::io_context ioc;
auto ws = std::make_shared<stream<test::stream>>(ioc);
test_op op{ws};
ws->next_layer().connect(es.stream());
ws->handshake("localhost", "/");
ws->async_ping("", op);
BEAST_EXPECT(ws->impl_->wr_block.is_locked());
ws->async_write(sbuf("*"), op);
weak_ws = ws;
ws->next_layer().close();
}
BEAST_EXPECT(weak_ws.expired());
}
void
testWriteSuspend()
{
@ -647,6 +679,7 @@ public:
run() override
{
testWrite();
testPausationAbandoning();
testWriteSuspend();
testAsyncWriteFrame();
testIssue300();