mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
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:
committed by
Vinnie Falco
parent
031e13c253
commit
72a99c43a7
@ -2,6 +2,7 @@ Version 223:
|
||||
|
||||
* Add test::stream::service
|
||||
* Add websocket service
|
||||
* Pausation abandoning test
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user