TLA Line data 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_NATIVE_DETAIL_SELECT_SELECT_TCP_SOCKET_HPP
11 : #define BOOST_COROSIO_NATIVE_DETAIL_SELECT_SELECT_TCP_SOCKET_HPP
12 :
13 : #include <boost/corosio/detail/platform.hpp>
14 :
15 : #if BOOST_COROSIO_HAS_SELECT
16 :
17 : #include <boost/corosio/native/detail/reactor/reactor_stream_socket.hpp>
18 : #include <boost/corosio/native/detail/select/select_op.hpp>
19 : #include <boost/capy/ex/executor_ref.hpp>
20 :
21 : namespace boost::corosio::detail {
22 :
23 : class select_tcp_service;
24 :
25 : /// Stream socket implementation for select backend.
26 : class select_tcp_socket final
27 : : public reactor_stream_socket<
28 : select_tcp_socket,
29 : select_tcp_service,
30 : select_connect_op,
31 : select_read_op,
32 : select_write_op,
33 : select_descriptor_state>
34 : {
35 : friend class select_tcp_service;
36 :
37 : public:
38 : explicit select_tcp_socket(select_tcp_service& svc) noexcept;
39 : ~select_tcp_socket() override;
40 :
41 : std::coroutine_handle<> connect(
42 : std::coroutine_handle<>,
43 : capy::executor_ref,
44 : endpoint,
45 : std::stop_token,
46 : std::error_code*) override;
47 :
48 : std::coroutine_handle<> read_some(
49 : std::coroutine_handle<>,
50 : capy::executor_ref,
51 : buffer_param,
52 : std::stop_token,
53 : std::error_code*,
54 : std::size_t*) override;
55 :
56 : std::coroutine_handle<> write_some(
57 : std::coroutine_handle<>,
58 : capy::executor_ref,
59 : buffer_param,
60 : std::stop_token,
61 : std::error_code*,
62 : std::size_t*) override;
63 :
64 HIT 3 : std::error_code shutdown(tcp_socket::shutdown_type what) noexcept override
65 : {
66 3 : return do_shutdown(static_cast<int>(what));
67 : }
68 :
69 : void cancel() noexcept override;
70 : void close_socket() noexcept;
71 : };
72 :
73 : } // namespace boost::corosio::detail
74 :
75 : #endif // BOOST_COROSIO_HAS_SELECT
76 :
77 : #endif // BOOST_COROSIO_NATIVE_DETAIL_SELECT_SELECT_TCP_SOCKET_HPP
|