| 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()); |
nothing calls this directly
no test coverage detected