MCPcopy Create free account
hub / github.com/boostorg/beast / testIssue1729

Method testIssue1729

test/beast/websocket/timer.cpp:90–157  ·  view source on GitHub ↗

https://github.com/boostorg/beast/issues/1729

Source from the content-addressed store, hash-verified

88
89 // https://github.com/boostorg/beast/issues/1729
90 void
91 testIssue1729()
92 {
93 {
94 net::io_context ioc;
95 stream<tcp::socket> ws1(ioc);
96 stream<tcp::socket> ws2(ioc);
97 test::connect(ws1.next_layer(), ws2.next_layer());
98
99 ws1.set_option(websocket::stream_base::timeout{
100 std::chrono::milliseconds(50),
101 websocket::stream_base::none(),
102 false});
103
104 ws1.async_accept(net::detached);
105 ws2.async_handshake(
106 "localhost", "/", net::detached);
107 ioc.run();
108 ioc.restart();
109
110 flat_buffer b;
111 error_code ec2;
112 ws1.async_close({},
113 [&ec2](error_code ec)
114 {
115 ec2 = ec;
116 });
117 ioc.run();
118 BEAST_EXPECTS(
119 ec2 == beast::error::timeout ||
120 ec2 == net::error::operation_aborted,
121 ec2.message());
122 }
123 {
124 net::io_context ioc;
125 stream<tcp::socket> ws1(ioc);
126 stream<tcp::socket> ws2(ioc);
127 test::connect(ws1.next_layer(), ws2.next_layer());
128
129 ws1.set_option(websocket::stream_base::timeout{
130 std::chrono::milliseconds(50),
131 websocket::stream_base::none(),
132 false});
133
134 ws1.async_accept(net::detached);
135 ws2.async_handshake(
136 "localhost", "/", net::detached);
137 ioc.run();
138 ioc.restart();
139
140 flat_buffer b;
141 error_code ec1, ec2;
142 ws1.async_read(b,
143 [&ec1](error_code ec, std::size_t)
144 {
145 ec1 = ec;
146 });
147 ws1.async_close({},

Callers

nothing calls this directly

Calls 8

noneClass · 0.85
set_optionMethod · 0.80
messageMethod · 0.80
async_readMethod · 0.80
connectFunction · 0.50
async_handshakeMethod · 0.45
runMethod · 0.45
async_closeMethod · 0.45

Tested by

no test coverage detected