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

Method testTimeout

test/beast/websocket/close.cpp:178–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176 }
177
178 void
179 testTimeout()
180 {
181 using tcp = net::ip::tcp;
182
183 net::io_context ioc;
184
185 // success
186
187 {
188 stream<tcp::socket> ws1(ioc);
189 stream<tcp::socket> ws2(ioc);
190 test::connect(ws1.next_layer(), ws2.next_layer());
191 ws1.async_handshake("test", "/", test::success_handler());
192 ws2.async_accept(test::success_handler());
193 test::run(ioc);
194
195 ws1.async_close({}, test::success_handler());
196 ws2.async_close({}, test::success_handler());
197 test::run(ioc);
198 }
199
200 {
201 stream<test::stream> ws1(ioc);
202 stream<test::stream> ws2(ioc);
203 test::connect(ws1.next_layer(), ws2.next_layer());
204 ws1.async_handshake("test", "/", test::success_handler());
205 ws2.async_accept(test::success_handler());
206 test::run(ioc);
207
208 ws1.async_close({}, test::success_handler());
209 ws2.async_close({}, test::success_handler());
210 test::run(ioc);
211 }
212
213 // success, timeout enabled
214
215 {
216 stream<tcp::socket> ws1(ioc);
217 stream<tcp::socket> ws2(ioc);
218 test::connect(ws1.next_layer(), ws2.next_layer());
219 ws1.async_handshake("test", "/", test::success_handler());
220 ws2.async_accept(test::success_handler());
221 test::run(ioc);
222
223 ws1.set_option(stream_base::timeout{
224 std::chrono::milliseconds(50),
225 stream_base::none(),
226 false});
227 ws1.async_close({}, test::success_handler());
228 ws2.async_close({}, test::success_handler());
229 test::run(ioc);
230 }
231
232 {
233 stream<test::stream> ws1(ioc);
234 stream<test::stream> ws2(ioc);
235 test::connect(ws1.next_layer(), ws2.next_layer());

Callers

nothing calls this directly

Calls 8

success_handlerFunction · 0.85
runFunction · 0.85
noneClass · 0.85
fail_handlerFunction · 0.85
set_optionMethod · 0.80
connectFunction · 0.50
async_handshakeMethod · 0.45
async_closeMethod · 0.45

Tested by

no test coverage detected