include/boost/corosio/detail/timeout_awaitable.hpp
100.0% Lines (61/61)
86.8% List of functions (99/114)
84.6% Branches (22/26)
Functions (114)
Function
Calls
Lines
Branches
Blocks
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::stop_forwarder::operator()() const
:84
1002x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::stop_forwarder::operator()() const
:84
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::stop_forwarder::operator()() const
:84
0
0.0%
–
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::timeout_awaitable(boost::corosio::delay_awaitable&&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > >)
:105
2x
100.0%
100.0%
72.7%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::timeout_awaitable(boost::corosio::tcp_socket::connect_awaitable&&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > >)
:105
0
0.0%
0.0%
0.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::timeout_awaitable(boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
3x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::timeout_awaitable(boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::timeout_awaitable(boost::capy::task<std::tuple<std::error_code, int> >&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::timeout_awaitable(boost::corosio::delay_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1012x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::timeout_awaitable(boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer>&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
2x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::timeout_awaitable(boost::corosio::payload_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
2x
100.0%
100.0%
88.9%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::timeout_awaitable(boost::corosio::tcp_socket::connect_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::timeout_awaitable(boost::corosio::tcp_socket::wait_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
75.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::timeout_awaitable(boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
88.9%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::timeout_awaitable(boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
88.9%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::timeout_awaitable(boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
88.9%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::timeout_awaitable(boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable&&, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> >)
:112
1x
100.0%
100.0%
88.9%
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::~timeout_awaitable()
:119
7x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::~timeout_awaitable()
:119
2029x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::~timeout_awaitable()
:119
4x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::~timeout_awaitable()
:119
3x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::~timeout_awaitable()
:119
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>&&)
:125
4x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>&&)
:125
1015x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >&&)
:125
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::timeout_awaitable(boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>&&)
:125
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::await_ready()
:145
3x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::await_ready()
:145
1014x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::await_ready()
:145
2x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::await_ready()
:145
1x
100.0%
–
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
3x
83.3%
60.0%
71.1%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
60.0%
71.1%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
55.6%
70.3%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1014x
88.9%
80.0%
76.3%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
60.0%
71.1%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
60.0%
71.1%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
2x
83.3%
60.0%
71.1%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
2x
94.4%
66.7%
83.8%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
60.0%
71.1%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
60.0%
71.1%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
55.6%
70.3%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
1x
83.3%
55.6%
70.3%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
0
0.0%
0.0%
0.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::await_suspend(std::__n4861::coroutine_handle<void>, boost::capy::io_env const*)
:150
0
0.0%
0.0%
0.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::await_resume()
:211
3x
100.0%
77.8%
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::await_resume()
:211
1x
75.0%
33.3%
54.5%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::await_resume()
:211
1x
91.7%
55.6%
90.9%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::await_resume()
:211
1012x
100.0%
87.5%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::await_resume()
:211
1x
75.0%
33.3%
54.5%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::await_resume()
:211
1x
75.0%
25.0%
52.4%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::await_resume()
:211
2x
91.7%
50.0%
90.5%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::await_resume()
:211
1x
75.0%
25.0%
52.4%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::await_resume()
:211
1x
75.0%
37.5%
57.1%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::await_resume()
:211
1x
91.7%
50.0%
90.5%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::await_resume()
:211
1x
75.0%
25.0%
52.4%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::await_resume()
:211
1x
33.3%
0.0%
18.2%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::await_resume()
:211
1x
75.0%
25.0%
52.4%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::await_resume()
:211
1x
75.0%
25.0%
52.4%
boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable>::destroy_parent_cb()
:250
10x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::any_write_stream::write_some<boost::capy::const_buffer>(boost::capy::const_buffer)::awaitable>::destroy_parent_cb()
:250
3x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::capy::task<std::tuple<std::error_code, int> > >::destroy_parent_cb()
:250
3x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable>::destroy_parent_cb()
:250
3041x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::capy::any_read_stream::read_some<boost::capy::mutable_buffer>(boost::capy::mutable_buffer)::awaitable> >::destroy_parent_cb()
:250
3x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::detail::timeout_awaitable<boost::corosio::delay_awaitable> >::destroy_parent_cb()
:250
3x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::io_read_stream::read_some_awaitable<boost::capy::mutable_buffer> >::destroy_parent_cb()
:250
6x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::payload_awaitable>::destroy_parent_cb()
:250
4x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::connect_awaitable>::destroy_parent_cb()
:250
3x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::tcp_socket::wait_awaitable>::destroy_parent_cb()
:250
3x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerErrorPassesThrough()::erroring_awaitable>::destroy_parent_cb()
:250
3x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testInnerExceptionPropagates()::throwing_awaitable>::destroy_parent_cb()
:250
2x
100.0%
100.0%
100.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCanceledNotRemapped()::ready_canceled_awaitable>::destroy_parent_cb()
:250
3x
50.0%
50.0%
40.0%
boost::corosio::detail::timeout_awaitable<boost::corosio::timeout_test<boost::corosio::iocp_t{}>::testReadyInnerCompletesWithoutSuspend()::ready_awaitable>::destroy_parent_cb()
:250
3x
50.0%
50.0%
40.0%
| Line | Branch | TLA | Hits | Source Code |
|---|---|---|---|---|
| 1 | // | |||
| 2 | // Copyright (c) 2026 Steve Gerbino | |||
| 3 | // | |||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||
| 6 | // | |||
| 7 | // Official repository: https://github.com/cppalliance/corosio | |||
| 8 | // | |||
| 9 | ||||
| 10 | #ifndef BOOST_COROSIO_DETAIL_TIMEOUT_AWAITABLE_HPP | |||
| 11 | #define BOOST_COROSIO_DETAIL_TIMEOUT_AWAITABLE_HPP | |||
| 12 | ||||
| 13 | #include <boost/corosio/io_context.hpp> | |||
| 14 | #include <boost/corosio/detail/timeout_coro.hpp> | |||
| 15 | #include <boost/corosio/detail/timer.hpp> | |||
| 16 | #include <boost/corosio/detail/except.hpp> | |||
| 17 | #include <boost/capy/cond.hpp> | |||
| 18 | #include <boost/capy/error.hpp> | |||
| 19 | #include <boost/capy/ex/io_env.hpp> | |||
| 20 | #include <boost/capy/io_result.hpp> | |||
| 21 | ||||
| 22 | #include <chrono> | |||
| 23 | #include <coroutine> | |||
| 24 | #include <new> | |||
| 25 | #include <optional> | |||
| 26 | #include <stdexcept> | |||
| 27 | #include <stop_token> | |||
| 28 | #include <type_traits> | |||
| 29 | #include <utility> | |||
| 30 | ||||
| 31 | /* Races an inner IoAwaitable against a timer via a shared | |||
| 32 | stop_source. await_suspend arms the timer by launching a | |||
| 33 | fire-and-forget timeout_coro, then starts the inner op with | |||
| 34 | an interposed stop_token. Whichever completes first signals | |||
| 35 | the stop_source, cancelling the other. | |||
| 36 | ||||
| 37 | Parent cancellation is forwarded through a stop_callback | |||
| 38 | stored in a placement-new buffer (stop_callback is not | |||
| 39 | movable, but the awaitable must be movable for | |||
| 40 | transform_awaiter). The buffer is inert during moves | |||
| 41 | (before await_suspend) and constructed in-place once the | |||
| 42 | awaitable is pinned on the coroutine frame. | |||
| 43 | ||||
| 44 | The timeout_coro can outlive this awaitable — it owns its | |||
| 45 | env and self-destroys via suspend_never. The timer lives in | |||
| 46 | std::optional and is constructed lazily in await_suspend, | |||
| 47 | once the awaiting coroutine's executor context is known. */ | |||
| 48 | ||||
| 49 | namespace boost::corosio::detail { | |||
| 50 | ||||
| 51 | // Local stand-in for capy::detail's io_result trait: corosio must not | |||
| 52 | // reach into capy::detail, but the result-mapping switch in | |||
| 53 | // await_resume needs to distinguish io_result from other return types. | |||
| 54 | template<typename T> | |||
| 55 | struct is_io_result : std::false_type | |||
| 56 | { | |||
| 57 | }; | |||
| 58 | ||||
| 59 | template<typename... Ts> | |||
| 60 | struct is_io_result<capy::io_result<Ts...>> : std::true_type | |||
| 61 | { | |||
| 62 | }; | |||
| 63 | ||||
| 64 | template<typename T> | |||
| 65 | inline constexpr bool is_io_result_v = is_io_result<T>::value; | |||
| 66 | ||||
| 67 | /** Awaitable adapter that cancels an inner operation after a deadline. | |||
| 68 | ||||
| 69 | Races the inner awaitable against a timer. A shared stop_source | |||
| 70 | ties them together: whichever completes first cancels the other. | |||
| 71 | Parent cancellation is forwarded via stop_callback. | |||
| 72 | ||||
| 73 | The timer is constructed internally in `await_suspend` from the | |||
| 74 | execution context in `io_env`. | |||
| 75 | ||||
| 76 | @tparam A The inner IoAwaitable type (decayed). | |||
| 77 | */ | |||
| 78 | template<typename A> | |||
| 79 | struct timeout_awaitable | |||
| 80 | { | |||
| 81 | struct stop_forwarder | |||
| 82 | { | |||
| 83 | std::stop_source* src_; | |||
| 84 | 1003x | void operator()() const noexcept | ||
| 85 | { | |||
| 86 | 1003x | src_->request_stop(); | ||
| 87 | 1003x | } | ||
| 88 | }; | |||
| 89 | ||||
| 90 | using time_point = std::chrono::steady_clock::time_point; | |||
| 91 | using stop_cb_type = std::stop_callback<stop_forwarder>; | |||
| 92 | ||||
| 93 | A inner_; | |||
| 94 | std::optional<timer> timer_; | |||
| 95 | time_point deadline_; | |||
| 96 | std::chrono::nanoseconds dur_{}; | |||
| 97 | bool has_deadline_ = true; | |||
| 98 | std::stop_source stop_src_; | |||
| 99 | std::stop_token parent_token_; | |||
| 100 | capy::io_env inner_env_; | |||
| 101 | alignas(stop_cb_type) unsigned char cb_buf_[sizeof(stop_cb_type)]; | |||
| 102 | bool cb_active_ = false; | |||
| 103 | ||||
| 104 | /// Construct without a timer, deadline given as an absolute time. | |||
| 105 | 2x | timeout_awaitable(A&& inner, time_point deadline) | ||
| 106 | 2x | : inner_(std::move(inner)) | ||
| 107 |
1/1✓ Branch 5 → 6 taken 2 times.
|
2x | , deadline_(deadline) | |
| 108 | { | |||
| 109 | 2x | } | ||
| 110 | ||||
| 111 | /// Construct without a timer, deadline measured from suspension. | |||
| 112 | 1029x | timeout_awaitable(A&& inner, std::chrono::nanoseconds dur) | ||
| 113 | 1029x | : inner_(std::move(inner)) | ||
| 114 | 1029x | , dur_(dur) | ||
| 115 |
2/2✓ Branch 5 → 6 taken 6 times.
✓ Branch 6 → 7 taken 1023 times.
|
1029x | , has_deadline_(false) | |
| 116 | { | |||
| 117 | 1029x | } | ||
| 118 | ||||
| 119 | 2063x | ~timeout_awaitable() | ||
| 120 | { | |||
| 121 | 2063x | destroy_parent_cb(); | ||
| 122 | 2063x | } | ||
| 123 | ||||
| 124 | // Only moved before await_suspend, when cb_active_ is false | |||
| 125 | 1032x | timeout_awaitable(timeout_awaitable&& o) noexcept( | ||
| 126 | std::is_nothrow_move_constructible_v<A>) | |||
| 127 | 1032x | : inner_(std::move(o.inner_)) | ||
| 128 | 1032x | , timer_(std::move(o.timer_)) | ||
| 129 | 1032x | , deadline_(o.deadline_) | ||
| 130 | 1032x | , dur_(o.dur_) | ||
| 131 | 1032x | , has_deadline_(o.has_deadline_) | ||
| 132 | 1032x | , stop_src_(std::move(o.stop_src_)) | ||
| 133 | { | |||
| 134 | 1032x | } | ||
| 135 | ||||
| 136 | timeout_awaitable(timeout_awaitable const&) = delete; | |||
| 137 | timeout_awaitable& operator=(timeout_awaitable const&) = delete; | |||
| 138 | timeout_awaitable& operator=(timeout_awaitable&&) = delete; | |||
| 139 | ||||
| 140 | // Forwarding here is load-bearing, not an optimization: awaitables | |||
| 141 | // may perform setup in await_ready (type-erased stream wrappers | |||
| 142 | // construct their cached inner op there), so the full awaiter | |||
| 143 | // protocol must reach inner_ before await_suspend is driven. An | |||
| 144 | // already-ready inner op also skips arming the timer entirely. | |||
| 145 | 1030x | bool await_ready() | ||
| 146 | { | |||
| 147 | 1030x | return inner_.await_ready(); | ||
| 148 | } | |||
| 149 | ||||
| 150 | 1029x | auto await_suspend(std::coroutine_handle<> h, capy::io_env const* env) | ||
| 151 | { | |||
| 152 | 1029x | parent_token_ = env->stop_token; | ||
| 153 | ||||
| 154 | // The deadline timer is built here from the awaiting | |||
| 155 | // coroutine's executor context, the first point at which it | |||
| 156 | // is known. await_suspend is driven through a noexcept | |||
| 157 | // wrapper, so a failure cannot be surfaced as a catchable | |||
| 158 | // exception. An executor whose context is not an io_context | |||
| 159 | // cannot supply a timer service; silently running the | |||
| 160 | // operation with no deadline would be a worse failure than | |||
| 161 | // aborting, so translate the service-lookup error into a | |||
| 162 | // clear precondition diagnostic. This terminates by design | |||
| 163 | // (a usage error) rather than dropping the requested timeout. | |||
| 164 | // The detached timeout coroutine must own its executor by | |||
| 165 | // value (see timeout_coro::set_env_owned); io_env carries | |||
| 166 | // only a non-owning executor_ref. Recover the concrete | |||
| 167 | // executor from the context rather than the executor_ref: | |||
| 168 | // wrapped executors (a strand over the io_context) satisfy | |||
| 169 | // the documented precondition but do not expose the io | |||
| 170 | // executor as their target. The timer construction below | |||
| 171 | // validates the context is an io_context, and the detached | |||
| 172 | // coroutine shares only the thread-safe stop_source with | |||
| 173 | // the caller, so resuming it on the raw io executor instead | |||
| 174 | // of the caller's wrapper is safe. | |||
| 175 | try | |||
| 176 | { | |||
| 177 |
1/1✓ Branch 4 → 5 taken 1028 times.
|
1029x | timer_.emplace(env->executor.context()); | |
| 178 | } | |||
| 179 |
1/4✗ Branch 29 → 30 not taken.
✓ Branch 29 → 31 taken 1 time.
✗ Branch 30 → 31 not taken.
✗ Branch 30 → 32 not taken.
|
2x | catch (std::logic_error const&) | |
| 180 | { | |||
| 181 | 1x | throw_logic_error( | ||
| 182 | "timeout requires an io_context-backed executor"); | |||
| 183 | } | |||
| 184 | auto ex = static_cast<io_context&>( | |||
| 185 | 1028x | env->executor.context()).get_executor(); | ||
| 186 | ||||
| 187 |
2/2✓ Branch 7 → 8 taken 2 times.
✓ Branch 7 → 10 taken 1026 times.
|
1028x | if (has_deadline_) | |
| 188 |
1/1✓ Branch 9 → 12 taken 2 times.
|
2x | timer_->expires_at(deadline_); | |
| 189 | else | |||
| 190 |
1/1✓ Branch 11 → 12 taken 1026 times.
|
1026x | timer_->expires_after(dur_); | |
| 191 | ||||
| 192 | // Launch fire-and-forget timeout (starts suspended) | |||
| 193 |
1/1✓ Branch 14 → 15 taken 1028 times.
|
1028x | auto timeout = make_timeout(*timer_, stop_src_); | |
| 194 | 2056x | timeout.h_.promise().set_env_owned( | ||
| 195 | 2056x | ex, stop_src_.get_token(), env->frame_allocator); | ||
| 196 | // Runs synchronously until timer.wait() suspends | |||
| 197 |
1/1✓ Branch 20 → 21 taken 1028 times.
|
1028x | timeout.h_.resume(); | |
| 198 | // timeout goes out of scope; destructor is a no-op, | |||
| 199 | // the coroutine self-destroys via suspend_never | |||
| 200 | ||||
| 201 | // Forward parent cancellation | |||
| 202 | 1028x | new (cb_buf_) stop_cb_type(env->stop_token, stop_forwarder{&stop_src_}); | ||
| 203 | 1028x | cb_active_ = true; | ||
| 204 | ||||
| 205 | // Start the inner op with our interposed stop_token | |||
| 206 | inner_env_ = { | |||
| 207 | 1028x | env->executor, stop_src_.get_token(), env->frame_allocator}; | ||
| 208 |
1/1✓ Branch 26 → 27 taken 1024 times.
|
2056x | return inner_.await_suspend(h, &inner_env_); | |
| 209 | 1028x | } | ||
| 210 | ||||
| 211 | 1028x | decltype(auto) await_resume() | ||
| 212 | { | |||
| 213 | // Read before request_stop: afterwards stop_requested() | |||
| 214 | // can no longer distinguish who fired first. This must also | |||
| 215 | // happen before inner_.await_resume() rather than after: when | |||
| 216 | // the inner awaitable is itself a timeout_awaitable (nested | |||
| 217 | // timeout()), our own request_stop() below is visible through | |||
| 218 | // its parent_token_ (aliasing our stop_src_), and would | |||
| 219 | // otherwise make its read of "parent" look like a | |||
| 220 | // cancellation that never happened. | |||
| 221 | 1028x | bool const parent = parent_token_.stop_requested(); | ||
| 222 | 1028x | bool const fired = stop_src_.stop_requested(); | ||
| 223 | ||||
| 224 | // If inner_.await_resume() throws below, request_stop() is | |||
| 225 | // skipped; the still-armed timeout coroutine is then drained | |||
| 226 | // by timer_'s destructor rather than by us. | |||
| 227 |
1/1✓ Branch 4 → 5 taken 6 times.
|
1028x | auto r = inner_.await_resume(); | |
| 228 | ||||
| 229 | // Cancel whichever is still pending (idempotent) | |||
| 230 | 1027x | stop_src_.request_stop(); | ||
| 231 | 1027x | destroy_parent_cb(); | ||
| 232 | ||||
| 233 | // Deadline won: stop_src_ is assumed to be the only | |||
| 234 | // cancellation source, whose only writers are the timer | |||
| 235 | // coroutine and the parent forwarder, so fired && !parent | |||
| 236 | // identifies a timeout. A third-party cancellation of the | |||
| 237 | // inner op (e.g. a socket cancel issued from elsewhere) | |||
| 238 | // landing in the same window as the deadline firing is | |||
| 239 | // reported as a timeout. | |||
| 240 |
5/6✓ Branch 7 → 8 taken 1016 times.
✓ Branch 7 → 14 taken 11 times.
✓ Branch 8 → 9 taken 13 times.
✓ Branch 8 → 14 taken 1003 times.
✓ Branch 12 → 13 taken 13 times.
✗ Branch 12 → 14 not taken.
|
1040x | if (fired && !parent && | |
| 241 |
2/2✓ Branch 15 → 16 taken 13 times.
✓ Branch 15 → 20 taken 1014 times.
|
1040x | std::get<0>(r) == capy::cond::canceled) | |
| 242 | { | |||
| 243 | 13x | std::remove_cvref_t<decltype(r)> t{}; | ||
| 244 | 13x | std::get<0>(t) = make_error_code(capy::error::timeout); | ||
| 245 | 13x | return t; | ||
| 246 | } | |||
| 247 | 1014x | return r; | ||
| 248 | } | |||
| 249 | ||||
| 250 | 3090x | void destroy_parent_cb() noexcept | ||
| 251 | { | |||
| 252 |
2/2✓ Branch 2 → 3 taken 1028 times.
✓ Branch 2 → 6 taken 2062 times.
|
3090x | if (cb_active_) | |
| 253 | { | |||
| 254 | 1028x | std::launder(reinterpret_cast<stop_cb_type*>(cb_buf_)) | ||
| 255 | 1028x | ->~stop_cb_type(); | ||
| 256 | 1028x | cb_active_ = false; | ||
| 257 | } | |||
| 258 | 3090x | } | ||
| 259 | }; | |||
| 260 | ||||
| 261 | } // namespace boost::corosio::detail | |||
| 262 | ||||
| 263 | #endif | |||
| 264 |