0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 13:18:58 +02:00

ircd::net: Add specific allow(acceptor) rather than using start(acceptor).

This commit is contained in:
Jason Volk 2019-03-21 17:07:35 -07:00
parent a6886dafe6
commit e133cd5a25
3 changed files with 18 additions and 6 deletions

View file

@ -25,6 +25,7 @@ namespace ircd::net
json::object config(const acceptor &); json::object config(const acceptor &);
string_view name(const acceptor &); string_view name(const acceptor &);
bool allow(acceptor &);
bool start(acceptor &); bool start(acceptor &);
bool stop(acceptor &); bool stop(acceptor &);
} }

View file

@ -1130,22 +1130,33 @@ ircd::net::acceptor::ssl_cipher_blacklist
{ "default", string_view{} }, { "default", string_view{} },
}; };
bool
ircd::net::stop(acceptor &a)
{
a.close();
return true;
}
bool bool
ircd::net::start(acceptor &a) ircd::net::start(acceptor &a)
{ {
if(!a.a.is_open()) if(!a.a.is_open())
a.open(); a.open();
if(!a.handle_set) allow(a);
a.set_handle();
return true; return true;
} }
bool 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; return true;
} }

View file

@ -219,7 +219,7 @@ _listener_proffer(net::listener &listener,
// Sets the asynchronous handler for the next accept. We can play with // Sets the asynchronous handler for the next accept. We can play with
// delaying this call under certain conditions to provide flow control. // 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))) if(unlikely(client::map.size() >= size_t(client::settings::max_client)))
{ {