diff --git a/include/ircd/client.h b/include/ircd/client.h index b246301e8..b816ca714 100644 --- a/include/ircd/client.h +++ b/include/ircd/client.h @@ -78,7 +78,7 @@ struct ircd::client client &operator=(const client &) = delete; ~client() noexcept; - static void create(net::listener &, const std::shared_ptr &); + static void create(net::acceptor &, const std::shared_ptr &); static size_t count(const net::ipport &remote); // cmp is by IP only, not port static void terminate_all(); static void interrupt_all(); diff --git a/include/ircd/net/acceptor.h b/include/ircd/net/acceptor.h index f98ff5167..1faadbfa1 100644 --- a/include/ircd/net/acceptor.h +++ b/include/ircd/net/acceptor.h @@ -49,7 +49,6 @@ ircd::net::acceptor static conf::item ssl_cipher_list; static conf::item ssl_cipher_blacklist; - net::listener *listener_; std::string name; std::string opts; std::string cname; @@ -81,7 +80,7 @@ ircd::net::acceptor void handshake(const error_code &, const std::shared_ptr, const decltype(handshaking)::const_iterator) noexcept; // Acceptance stack - static bool proffer_default(listener &, const ipport &); + static bool proffer_default(acceptor &, const ipport &); bool check_handshake_limit(socket &, const ipport &) const; bool check_accept_error(const error_code &ec, socket &) const; void accept(const error_code &, const std::shared_ptr) noexcept; diff --git a/include/ircd/net/listener.h b/include/ircd/net/listener.h index 3a330f109..207800e4f 100644 --- a/include/ircd/net/listener.h +++ b/include/ircd/net/listener.h @@ -46,8 +46,8 @@ namespace ircd::net /// reject connections by returning false. struct ircd::net::listener { - using callback = std::function &)>; - using proffer = std::function; + using callback = std::function &)>; + using proffer = std::function; IRCD_EXCEPTION(net::error, error) diff --git a/ircd/client.cc b/ircd/client.cc index b48637655..dbf93d776 100644 --- a/ircd/client.cc +++ b/ircd/client.cc @@ -333,7 +333,7 @@ ircd::client::terminate_all() } void -ircd::client::create(net::listener &, +ircd::client::create(net::acceptor &, const std::shared_ptr &sock) { const auto client diff --git a/ircd/net_listener.cc b/ircd/net_listener.cc index 717f1ef03..7b2405cc3 100644 --- a/ircd/net_listener.cc +++ b/ircd/net_listener.cc @@ -282,11 +282,7 @@ ircd::net::acceptor::acceptor(net::listener &listener, listener::callback cb, listener::proffer pcb) try -:listener_ -{ - &listener -} -,name +:name { name } @@ -569,7 +565,7 @@ noexcept try // Call the proffer-callback. This allows the application to check whether // to allow or deny this remote before the handshake, as well as setting // the next accept to shape the kernel's queue. - if(!pcb(*listener_, remote)) + if(!pcb(*this, remote)) { net::close(*sock, dc::RST, close_ignore); return; @@ -708,10 +704,10 @@ const /// next accept to take place as well. This is generally overriden by a /// user callback to control this behavior. bool -ircd::net::acceptor::proffer_default(listener &listener, +ircd::net::acceptor::proffer_default(acceptor &acceptor, const ipport &ipport) { - allow(listener); + allow(acceptor); return true; } @@ -758,7 +754,7 @@ noexcept try // Toggles the behavior of non-async functions; see func comment blocking(*sock, false); - cb(*listener_, sock); + cb(*this, sock); } catch(const ctx::interrupted &e) { diff --git a/modules/m_listen.cc b/modules/m_listen.cc index 66b898d8f..f2f935ae0 100644 --- a/modules/m_listen.cc +++ b/modules/m_listen.cc @@ -317,7 +317,7 @@ listener_whitelist }; static bool -_listener_proffer(net::listener &listener, +_listener_proffer(net::acceptor &listener, const net::ipport &ipport) { thread_local char strbuf[256];