From ab77a32dcea57cd7d820e29e976ebe0d29eb90ba Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 24 Feb 2023 20:10:17 -0800 Subject: [PATCH] ircd::m::fed::well_known: Deduplicate requests sharing the same buffer only. --- matrix/fed_well_known.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/matrix/fed_well_known.cc b/matrix/fed_well_known.cc index 1c71fd519..71ecf8251 100644 --- a/matrix/fed_well_known.cc +++ b/matrix/fed_well_known.cc @@ -233,13 +233,20 @@ try }; } - // Ride any duplicate request already pending + // Check for duplicate requests for(const auto &req : request::list) if(req->target == target) + { + //XXX: Support multiple result buffers. + if(data(req->out) != data(buf)) + break; + + // Ride any duplicate request already pending return ctx::future { req->promise }; + } // Synchronize modification of the request::list const std::lock_guard request_lock