17#ifndef TOOLBOX_NET_STREAMCONNECTOR_HPP
18#define TOOLBOX_NET_STREAMCONNECTOR_HPP
26template <
typename DerivedT>
49 static_cast<DerivedT*
>(
this)->on_sock_prepare(now,
sock);
51 if (
sock.is_ip_family()) {
54 throw std::runtime_error{
"TCP_NODELAY option not set"};
61 if (
ec != std::errc::operation_in_progress) {
62 throw std::system_error{
ec,
"connect"};
67 sock_ = std::move(
sock);
78 void on_io_event(
CyclTime now,
int ,
unsigned )
83 const auto ec =
sock.get_error();
85 throw std::system_error{
ec,
"connect"};
88 }
catch (
const std::system_error& e) {
90 }
catch (
const std::exception& e) {