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:
parent
d50714ab7d
commit
ea3f7abde5
2 changed files with 8 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue