7#include <boost/assert.hpp>
21#include <sys/socket.h>
34 uint16_t target_host_port,
int af_hint = AF_UNSPEC);
65 std::optional<std::coroutine_handle<>>
handle_;
84 void bind(
const struct sockaddr *addr,
int flags);
AddressHandle is a light-weight wrapper around a struct sockaddr_in(6), and is therefore cheap to cop...
Definition name_resolution.h:38
Definition stream_server_base.h:38
A client for connecting to a TCP peer.
Definition tcp.h:29
Promise< TcpStream > connect()
Definition tcp.cc:48
TcpClient & operator=(const TcpClient &)=delete
TcpClient & operator=(TcpClient &&other) noexcept
Definition tcp.cc:41
static void onConnect(uv_connect_t *req, uv_status status)
Definition tcp.cc:79
TcpClient(const TcpClient &)=delete
TcpClient(const Loop &loop, std::string target_host_address, uint16_t target_host_port, int af_hint=AF_UNSPEC)
Definition tcp.cc:28
uint16_t port_
Definition tcp.h:54
int af_hint_
Definition tcp.h:53
const Loop * loop_
Definition tcp.h:49
std::string host_
Definition tcp.h:52
TcpServer(const Loop &loop, AddressHandle bindAddress, bool ipv6Only=false)
Sets up and bind socket to address.
Definition tcp.cc:107
void bind(const struct sockaddr *addr, int flags)
Definition tcp.cc:115
TcpServer(const TcpServer &)=delete
TcpServer & operator=(TcpServer &&)=default
TcpServer(TcpServer &&)=default
TcpServer & operator=(const TcpServer &)=delete
int uv_status
Result of a libuv operation, an errno error code.
Definition internal_utils.h:22
Definition async_work.cc:17
void onConnect(uv_status status)
Definition tcp.cc:99
bool await_suspend(std::coroutine_handle<> handle)
Definition tcp.cc:88
std::optional< std::coroutine_handle<> > handle_
Definition tcp.h:65
uv_status await_resume()
Definition tcp.cc:94
std::optional< uv_status > status_
Definition tcp.h:66
bool await_ready() const
Definition tcp.cc:84