From 9b23b4d9079ddb9b468e0f48ee9accf14f50c4aa Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 29 Aug 2019 19:28:37 -0700 Subject: [PATCH] ircd::m::fetch: Add remote hinting to fetch::opts. --- include/ircd/m/fetch.h | 5 +++++ modules/m_fetch.cc | 3 +++ 2 files changed, 8 insertions(+) diff --git a/include/ircd/m/fetch.h b/include/ircd/m/fetch.h index f3503f798..287f019f6 100644 --- a/include/ircd/m/fetch.h +++ b/include/ircd/m/fetch.h @@ -89,6 +89,11 @@ struct ircd::m::fetch::opts /// where 16_KiB is [current server default] for headers and 64_KiB is /// m::event::MAX_SIZE. size_t bufsz {0}; + + /// Name of a remote server which will be queried first; if failure, + /// the normal room_id based operation is the fallback. If the room + /// is not known to us, it would be best to set this. + string_view hint; }; struct ircd::m::fetch::result diff --git a/modules/m_fetch.cc b/modules/m_fetch.cc index 8181ee924..8c72cd0f2 100644 --- a/modules/m_fetch.cc +++ b/modules/m_fetch.cc @@ -390,6 +390,9 @@ bool ircd::m::fetch::start(request &request) try { assert(!request.finished); + if(!request.started && !request.origin) + request.origin = request.opts.hint; + if(!request.started) request.started = ircd::now();