0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::server: Add state to deny any resubmission on peer close.

This commit is contained in:
Jason Volk 2018-03-06 04:51:20 -08:00
parent d50714ab7d
commit ea3f7abde5
2 changed files with 8 additions and 3 deletions

View file

@ -25,6 +25,7 @@ struct ircd::server::peer
string_view emsg; // points to eptr->what()
steady_point etime; // time of error
std::string server_name;
bool ready {true};
template<class F> size_t accumulate_links(F&&) const;
template<class F> size_t accumulate_tags(F&&) const;

View file

@ -309,9 +309,7 @@ noexcept
void
ircd::server::peer::close(const net::close_opts &opts)
{
for(auto &link : this->links)
link.exclude = true;
ready = false;
std::vector<link *> links(this->links.size());
pointers(this->links, links);
for(const auto &link : links)
@ -354,6 +352,12 @@ void
ircd::server::peer::submit(request &request)
try
{
if(unlikely(!ready || !server::ready))
throw unavailable
{
"Peer is unable to take any requests."
};
link *const ret
{
link_get(request)