mirror of
https://github.com/matrix-construct/construct
synced 2024-07-01 00:08:22 +02:00
ircd::net: Add specific allow(acceptor) rather than using start(acceptor).
This commit is contained in:
parent
a6886dafe6
commit
e133cd5a25
|
@ -25,6 +25,7 @@ namespace ircd::net
|
|||
json::object config(const acceptor &);
|
||||
string_view name(const acceptor &);
|
||||
|
||||
bool allow(acceptor &);
|
||||
bool start(acceptor &);
|
||||
bool stop(acceptor &);
|
||||
}
|
||||
|
|
21
ircd/net.cc
21
ircd/net.cc
|
@ -1130,22 +1130,33 @@ ircd::net::acceptor::ssl_cipher_blacklist
|
|||
{ "default", string_view{} },
|
||||
};
|
||||
|
||||
bool
|
||||
ircd::net::stop(acceptor &a)
|
||||
{
|
||||
a.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::net::start(acceptor &a)
|
||||
{
|
||||
if(!a.a.is_open())
|
||||
a.open();
|
||||
|
||||
if(!a.handle_set)
|
||||
a.set_handle();
|
||||
|
||||
allow(a);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::net::stop(acceptor &a)
|
||||
ircd::net::allow(acceptor &a)
|
||||
{
|
||||
a.close();
|
||||
if(unlikely(!a.a.is_open()))
|
||||
return false;
|
||||
|
||||
if(unlikely(a.handle_set))
|
||||
return false;
|
||||
|
||||
a.set_handle();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ _listener_proffer(net::listener &listener,
|
|||
|
||||
// Sets the asynchronous handler for the next accept. We can play with
|
||||
// delaying this call under certain conditions to provide flow control.
|
||||
start(listener);
|
||||
allow(listener);
|
||||
|
||||
if(unlikely(client::map.size() >= size_t(client::settings::max_client)))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue