| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2026 Steve Gerbino
|
2 |
|
// Copyright (c) 2026 Steve Gerbino
|
| 3 |
|
|
3 |
|
|
| 4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
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)
|
5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
|
|
6 |
|
|
| 7 |
|
// Official repository: https://github.com/cppalliance/corosio
|
7 |
|
// Official repository: https://github.com/cppalliance/corosio
|
| 8 |
|
|
8 |
|
|
| 9 |
|
|
9 |
|
|
| 10 |
|
#ifndef BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_TCP_SOCKET_HPP
|
10 |
|
#ifndef BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_TCP_SOCKET_HPP
|
| 11 |
|
#define BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_TCP_SOCKET_HPP
|
11 |
|
#define BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_TCP_SOCKET_HPP
|
| 12 |
|
|
12 |
|
|
| 13 |
|
#include <boost/corosio/detail/platform.hpp>
|
13 |
|
#include <boost/corosio/detail/platform.hpp>
|
| 14 |
|
|
14 |
|
|
| 15 |
|
#if BOOST_COROSIO_HAS_EPOLL
|
15 |
|
#if BOOST_COROSIO_HAS_EPOLL
|
| 16 |
|
|
16 |
|
|
| 17 |
|
#include <boost/corosio/native/detail/reactor/reactor_stream_socket.hpp>
|
17 |
|
#include <boost/corosio/native/detail/reactor/reactor_stream_socket.hpp>
|
| 18 |
|
#include <boost/corosio/native/detail/epoll/epoll_op.hpp>
|
18 |
|
#include <boost/corosio/native/detail/epoll/epoll_op.hpp>
|
| 19 |
|
#include <boost/capy/ex/executor_ref.hpp>
|
19 |
|
#include <boost/capy/ex/executor_ref.hpp>
|
| 20 |
|
|
20 |
|
|
| 21 |
|
namespace boost::corosio::detail {
|
21 |
|
namespace boost::corosio::detail {
|
| 22 |
|
|
22 |
|
|
| 23 |
|
|
23 |
|
|
| 24 |
|
|
24 |
|
|
| 25 |
|
/// Stream socket implementation for epoll backend.
|
25 |
|
/// Stream socket implementation for epoll backend.
|
| 26 |
|
class epoll_tcp_socket final
|
26 |
|
class epoll_tcp_socket final
|
| 27 |
|
: public reactor_stream_socket<
|
27 |
|
: public reactor_stream_socket<
|
| 28 |
|
|
28 |
|
|
| 29 |
|
|
29 |
|
|
| 30 |
|
|
30 |
|
|
| 31 |
|
|
31 |
|
|
| 32 |
|
|
32 |
|
|
| 33 |
|
|
33 |
|
|
| 34 |
|
|
34 |
|
|
| 35 |
|
friend class epoll_tcp_service;
|
35 |
|
friend class epoll_tcp_service;
|
| 36 |
|
|
36 |
|
|
| 37 |
|
|
37 |
|
|
| 38 |
|
explicit epoll_tcp_socket(epoll_tcp_service& svc) noexcept;
|
38 |
|
explicit epoll_tcp_socket(epoll_tcp_service& svc) noexcept;
|
| 39 |
|
~epoll_tcp_socket() override;
|
39 |
|
~epoll_tcp_socket() override;
|
| 40 |
|
|
40 |
|
|
| 41 |
|
std::coroutine_handle<> connect(
|
41 |
|
std::coroutine_handle<> connect(
|
| 42 |
|
|
42 |
|
|
| 43 |
|
|
43 |
|
|
| 44 |
|
|
44 |
|
|
| 45 |
|
|
45 |
|
|
| 46 |
|
std::error_code*) override;
|
46 |
|
std::error_code*) override;
|
| 47 |
|
|
47 |
|
|
| 48 |
|
std::coroutine_handle<> read_some(
|
48 |
|
std::coroutine_handle<> read_some(
|
| 49 |
|
|
49 |
|
|
| 50 |
|
|
50 |
|
|
| 51 |
|
|
51 |
|
|
| 52 |
|
|
52 |
|
|
| 53 |
|
|
53 |
|
|
| 54 |
|
|
54 |
|
|
| 55 |
|
|
55 |
|
|
| 56 |
|
std::coroutine_handle<> write_some(
|
56 |
|
std::coroutine_handle<> write_some(
|
| 57 |
|
|
57 |
|
|
| 58 |
|
|
58 |
|
|
| 59 |
|
|
59 |
|
|
| 60 |
|
|
60 |
|
|
| 61 |
|
|
61 |
|
|
| 62 |
|
|
62 |
|
|
| 63 |
|
|
63 |
|
|
|
|
|
64 |
+ |
std::error_code shutdown(tcp_socket::shutdown_type what) noexcept override
|
|
|
|
65 |
+ |
|
|
|
|
66 |
+ |
return do_shutdown(static_cast<int>(what));
|
|
|
|
67 |
+ |
|
|
|
|
68 |
+ |
|
| 64 |
|
void cancel() noexcept override;
|
69 |
|
void cancel() noexcept override;
|
| 65 |
|
void close_socket() noexcept;
|
70 |
|
void close_socket() noexcept;
|
| 66 |
|
|
71 |
|
|
| 67 |
|
|
72 |
|
|
| 68 |
|
} // namespace boost::corosio::detail
|
73 |
|
} // namespace boost::corosio::detail
|
| 69 |
|
|
74 |
|
|
| 70 |
|
#endif // BOOST_COROSIO_HAS_EPOLL
|
75 |
|
#endif // BOOST_COROSIO_HAS_EPOLL
|
| 71 |
|
|
76 |
|
|
| 72 |
|
#endif // BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_TCP_SOCKET_HPP
|
77 |
|
#endif // BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_TCP_SOCKET_HPP
|