| 53 | } |
| 54 | |
| 55 | static |
| 56 | void |
| 57 | fail_loop( |
| 58 | std::function<void( |
| 59 | stream<test::basic_stream<net::io_context::executor_type>>&)> |
| 60 | f, |
| 61 | std::chrono::steady_clock::duration amount = |
| 62 | std::chrono::seconds(5)) |
| 63 | { |
| 64 | using clock_type = std::chrono::steady_clock; |
| 65 | auto const expires_at = |
| 66 | clock_type::now() + amount; |
| 67 | net::io_context ioc; |
| 68 | for(std::size_t n = 0;;++n) |
| 69 | { |
| 70 | test::fail_count fc(n); |
| 71 | try |
| 72 | { |
| 73 | stream<test::basic_stream<net::io_context::executor_type>> |
| 74 | ws(ioc, fc); |
| 75 | auto tr = connect(ws.next_layer()); |
| 76 | f(ws); |
| 77 | break; |
| 78 | } |
| 79 | catch(system_error const& se) |
| 80 | { |
| 81 | // VFALCO Commented this out after the short |
| 82 | // read change, because it converts test_failure |
| 83 | // into http::partial_message |
| 84 | // |
| 85 | boost::ignore_unused(se); |
| 86 | #if 0 |
| 87 | if(! BEAST_EXPECTS( |
| 88 | se.code() == test::error::test_failure, |
| 89 | se.code().message())) |
| 90 | throw; |
| 91 | #endif |
| 92 | if(! BEAST_EXPECTS( |
| 93 | clock_type::now() < expires_at, |
| 94 | "a test timeout occurred")) |
| 95 | break; |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | template<class Api> |
| 101 | void |