0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

ircd::server: Add peer level aggregate for cleanup_canceled().

This commit is contained in:
Jason Volk 2020-03-04 11:55:08 -08:00
parent 12bdc39b20
commit e7eb5a62c7
3 changed files with 13 additions and 3 deletions

View file

@ -57,6 +57,7 @@ struct ircd::server::link
void handle_close(std::exception_ptr);
void handle_open(std::exception_ptr);
void cleanup_canceled();
public:
// config related
@ -94,7 +95,6 @@ struct ircd::server::link
void cancel_uncommitted(std::exception_ptr);
void cancel_committed(std::exception_ptr);
void cancel_all(std::exception_ptr);
void cleanup_canceled();
void submit(request &);
// control panel

View file

@ -53,6 +53,7 @@ struct ircd::server::peer
void resolve(const hostport &, const net::dns::opts &);
void resolve(const hostport &);
void cleanup_canceled();
void disperse_uncommitted(link &);
void disperse(link &);
void del(link &);

View file

@ -711,6 +711,10 @@ try
err_msg()
};
// Run a GC over the links and tags for this peer first.
cleanup_canceled();
// Select the best link for this request or create anew.
link *const ret
{
link_get(request)
@ -1129,6 +1133,13 @@ ircd::server::peer::disperse_uncommitted(link &link)
}
}
void
ircd::server::peer::cleanup_canceled()
{
for(auto &link : links)
link.cleanup_canceled();
}
/// This *cannot* be called unless a link's socket is closed and its queue
/// is empty. It is usually only called by a disconnect handler because
/// the proper way to remove a link is asynchronously through link.close();
@ -1774,8 +1785,6 @@ ircd::server::link::submit(request &request)
tag_count()
};
*/
cleanup_canceled();
if(ready())
wait_writable();
}