From 844bf46a5c97075a429bdf70956473c18c27a20f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 6 Sep 2019 20:01:53 -0700 Subject: [PATCH] ircd::server: Add a canceled tag reaper. --- include/ircd/server/link.h | 1 + ircd/server.cc | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/ircd/server/link.h b/include/ircd/server/link.h index 560827605..426526e70 100644 --- a/include/ircd/server/link.h +++ b/include/ircd/server/link.h @@ -94,6 +94,7 @@ 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 diff --git a/ircd/server.cc b/ircd/server.cc index afed1a7ee..de1815fc8 100644 --- a/ircd/server.cc +++ b/ircd/server.cc @@ -1737,10 +1737,29 @@ ircd::server::link::submit(request &request) tag_count() }; */ + cleanup_canceled(); + if(ready()) wait_writable(); } +void +ircd::server::link::cleanup_canceled() +{ + auto it(begin(queue)); + while(it != end(queue)) + { + auto &tag{*it}; + if(tag.committed() || tag.request) + { + ++it; + continue; + } + + it = queue.erase(it); + } +} + void ircd::server::link::cancel_all(std::exception_ptr eptr) {