2018-06-03 19:02:19 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
2019-08-28 00:03:44 +02:00
|
|
|
// Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
|
2018-06-03 19:02:19 +02:00
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
2019-08-28 00:03:44 +02:00
|
|
|
namespace ircd::m::fetch
|
|
|
|
{
|
2019-08-31 10:53:58 +02:00
|
|
|
static bool operator==(const opts &a, const opts &b) noexcept;
|
|
|
|
static bool operator==(const request &a, const opts &b) noexcept;
|
|
|
|
static bool operator==(const opts &a, const request &b) noexcept;
|
|
|
|
static bool operator==(const request &a, const request &b) noexcept;
|
|
|
|
static bool operator<(const opts &a, const opts &b) noexcept;
|
2019-08-30 03:30:47 +02:00
|
|
|
static bool operator<(const request &a, const opts &b) noexcept;
|
|
|
|
static bool operator<(const opts &a, const request &b) noexcept;
|
2019-08-31 10:53:58 +02:00
|
|
|
static bool operator<(const request &a, const request &b) noexcept;
|
2019-08-28 00:03:44 +02:00
|
|
|
|
|
|
|
extern ctx::dock dock;
|
|
|
|
extern ctx::mutex requests_mutex;
|
|
|
|
extern std::set<request, std::less<>> requests;
|
|
|
|
extern ctx::context request_context;
|
2019-09-16 21:12:43 +02:00
|
|
|
extern conf::item<size_t> backfill_limit_default;
|
2019-08-28 00:03:44 +02:00
|
|
|
extern conf::item<size_t> requests_max;
|
|
|
|
extern conf::item<seconds> timeout;
|
|
|
|
extern conf::item<bool> enable;
|
|
|
|
extern log::log log;
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
static bool timedout(const request &, const system_point &now);
|
2022-08-09 20:47:59 +02:00
|
|
|
extern void check_response(const request &, const json::object &);
|
2020-10-29 12:41:11 +01:00
|
|
|
static bool proffer_remote(request &, const string_view &);
|
|
|
|
static bool select_remote(request &, const string_view &);
|
|
|
|
static bool select_random_remote(request &);
|
2019-08-28 00:03:44 +02:00
|
|
|
static void finish(request &);
|
|
|
|
static void retry(request &);
|
2019-08-30 03:30:47 +02:00
|
|
|
static bool start(request &, const string_view &remote);
|
2019-08-28 00:03:44 +02:00
|
|
|
static bool start(request &);
|
2019-08-30 03:30:47 +02:00
|
|
|
static void handle_result(request &);
|
2019-08-28 00:03:44 +02:00
|
|
|
static bool handle(request &);
|
|
|
|
|
2019-09-04 02:05:52 +02:00
|
|
|
static bool request_handle(const decltype(requests)::iterator &);
|
2019-08-28 00:03:44 +02:00
|
|
|
static void request_handle();
|
|
|
|
static size_t request_cleanup();
|
|
|
|
static void request_worker();
|
|
|
|
}
|
2018-06-03 19:02:19 +02:00
|
|
|
|
2019-07-27 00:39:23 +02:00
|
|
|
decltype(ircd::m::fetch::log)
|
|
|
|
ircd::m::fetch::log
|
|
|
|
{
|
2019-08-01 04:40:18 +02:00
|
|
|
"m.fetch"
|
2019-07-27 00:39:23 +02:00
|
|
|
};
|
|
|
|
|
2019-04-12 05:53:57 +02:00
|
|
|
decltype(ircd::m::fetch::enable)
|
|
|
|
ircd::m::fetch::enable
|
|
|
|
{
|
|
|
|
{ "name", "ircd.m.fetch.enable" },
|
2019-04-23 22:27:53 +02:00
|
|
|
{ "default", true },
|
2019-04-12 05:53:57 +02:00
|
|
|
};
|
|
|
|
|
2019-04-15 20:37:13 +02:00
|
|
|
decltype(ircd::m::fetch::timeout)
|
|
|
|
ircd::m::fetch::timeout
|
|
|
|
{
|
|
|
|
{ "name", "ircd.m.fetch.timeout" },
|
2019-04-26 14:28:18 +02:00
|
|
|
{ "default", 5L },
|
|
|
|
};
|
|
|
|
|
2019-06-06 02:12:02 +02:00
|
|
|
decltype(ircd::m::fetch::requests_max)
|
|
|
|
ircd::m::fetch::requests_max
|
|
|
|
{
|
|
|
|
{ "name", "ircd.m.fetch.requests.max" },
|
2022-07-16 00:38:15 +02:00
|
|
|
{ "default", 2048L },
|
2019-06-06 02:12:02 +02:00
|
|
|
};
|
|
|
|
|
2019-09-16 21:12:43 +02:00
|
|
|
decltype(ircd::m::fetch::backfill_limit_default)
|
|
|
|
ircd::m::fetch::backfill_limit_default
|
|
|
|
{
|
|
|
|
{ "name", "ircd.m.fetch.backfill.limit.default" },
|
|
|
|
{ "default", 96L },
|
|
|
|
};
|
|
|
|
|
2020-03-16 21:37:46 +01:00
|
|
|
decltype(ircd::m::fetch::dock)
|
|
|
|
ircd::m::fetch::dock;
|
2019-04-11 06:16:00 +02:00
|
|
|
|
|
|
|
decltype(ircd::m::fetch::requests)
|
|
|
|
ircd::m::fetch::requests;
|
|
|
|
|
2019-08-27 00:12:43 +02:00
|
|
|
decltype(ircd::m::fetch::requests_mutex)
|
|
|
|
ircd::m::fetch::requests_mutex;
|
|
|
|
|
2020-03-16 21:37:46 +01:00
|
|
|
decltype(ircd::m::fetch::request_context)
|
|
|
|
ircd::m::fetch::request_context
|
|
|
|
{
|
|
|
|
"m.fetch.req",
|
|
|
|
1_MiB,
|
|
|
|
&request_worker,
|
|
|
|
context::POST
|
|
|
|
};
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2019-04-22 21:32:54 +02:00
|
|
|
//
|
|
|
|
// init
|
|
|
|
//
|
|
|
|
|
2019-09-28 06:18:07 +02:00
|
|
|
ircd::m::fetch::init::init()
|
2019-04-22 21:32:54 +02:00
|
|
|
{
|
2020-03-16 21:37:46 +01:00
|
|
|
assert(requests.empty());
|
2019-04-22 21:32:54 +02:00
|
|
|
}
|
|
|
|
|
2019-09-28 06:18:07 +02:00
|
|
|
ircd::m::fetch::init::~init()
|
|
|
|
noexcept
|
2019-04-22 21:32:54 +02:00
|
|
|
{
|
|
|
|
request_context.terminate();
|
|
|
|
request_context.join();
|
|
|
|
requests.clear();
|
|
|
|
assert(requests.empty());
|
2019-04-26 13:00:58 +02:00
|
|
|
}
|
|
|
|
|
2019-04-11 06:16:00 +02:00
|
|
|
//
|
2019-08-28 04:34:46 +02:00
|
|
|
// <ircd/m/fetch.h>
|
2019-04-11 06:16:00 +02:00
|
|
|
//
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
ircd::ctx::future<ircd::m::fetch::result>
|
|
|
|
ircd::m::fetch::start(opts opts)
|
|
|
|
{
|
|
|
|
assert(opts.room_id && opts.event_id);
|
2020-05-12 06:32:48 +02:00
|
|
|
if(unlikely(run::level == run::level::QUIT))
|
|
|
|
throw m::UNAVAILABLE
|
|
|
|
{
|
|
|
|
"Cannot start fetch requests at this time."
|
|
|
|
};
|
2019-08-30 03:30:47 +02:00
|
|
|
|
|
|
|
// in case requests are started before runlevel RUN they are stalled here
|
2020-03-16 21:11:00 +01:00
|
|
|
run::barrier<m::UNAVAILABLE>
|
|
|
|
{
|
|
|
|
"The fetch unit is unavailable to start requests."
|
|
|
|
};
|
2019-04-12 23:15:06 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
// in case the fetch unit has reached capacity the context will yield.
|
2019-08-27 00:12:43 +02:00
|
|
|
dock.wait([]
|
|
|
|
{
|
|
|
|
return count() < size_t(requests_max);
|
|
|
|
});
|
2019-06-06 02:12:02 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
// the state in this unit is primarily driven by the fetch::context; in
|
|
|
|
// some cases it may want to prevent others from changing this state until
|
|
|
|
// it's ready to accept.
|
|
|
|
std::unique_lock lock
|
|
|
|
{
|
|
|
|
requests_mutex
|
|
|
|
};
|
|
|
|
|
|
|
|
const scope_notify dock
|
|
|
|
{
|
|
|
|
fetch::dock
|
|
|
|
};
|
|
|
|
|
|
|
|
auto it
|
|
|
|
{
|
|
|
|
requests.lower_bound(opts)
|
|
|
|
};
|
|
|
|
|
2019-09-01 08:21:42 +02:00
|
|
|
const bool exists
|
2019-08-30 03:30:47 +02:00
|
|
|
{
|
2019-09-01 08:21:42 +02:00
|
|
|
it != end(requests) && *it == opts
|
|
|
|
};
|
|
|
|
|
|
|
|
assert(!exists || it->opts.room_id == opts.room_id);
|
|
|
|
if(!exists)
|
2022-07-04 05:49:12 +02:00
|
|
|
it = requests.emplace_hint(it, std::move(opts));
|
2019-08-30 03:30:47 +02:00
|
|
|
|
|
|
|
auto &request
|
|
|
|
{
|
|
|
|
const_cast<fetch::request &>(*it)
|
|
|
|
};
|
|
|
|
|
|
|
|
ctx::future<result> ret
|
|
|
|
{
|
|
|
|
request.promise
|
|
|
|
};
|
|
|
|
|
2019-09-01 08:21:42 +02:00
|
|
|
if(!exists)
|
|
|
|
start(request);
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
return ret;
|
2019-04-12 13:02:09 +02:00
|
|
|
}
|
|
|
|
|
2019-06-05 03:50:17 +02:00
|
|
|
size_t
|
|
|
|
ircd::m::fetch::count()
|
|
|
|
{
|
2019-07-21 02:01:34 +02:00
|
|
|
return requests.size();
|
|
|
|
}
|
2019-06-05 03:50:17 +02:00
|
|
|
|
2019-07-21 02:01:34 +02:00
|
|
|
bool
|
2019-08-30 03:30:47 +02:00
|
|
|
ircd::m::fetch::exists(const opts &opts)
|
2019-07-21 02:01:34 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
return requests.count(opts);
|
2019-06-05 03:50:17 +02:00
|
|
|
}
|
|
|
|
|
2019-04-12 13:02:09 +02:00
|
|
|
bool
|
|
|
|
ircd::m::fetch::for_each(const std::function<bool (request &)> &closure)
|
|
|
|
{
|
|
|
|
for(auto &request : requests)
|
|
|
|
if(!closure(const_cast<fetch::request &>(request)))
|
2019-03-27 21:44:33 +01:00
|
|
|
return false;
|
2018-09-05 08:27:01 +02:00
|
|
|
|
2019-03-27 21:44:33 +01:00
|
|
|
return true;
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
ircd::string_view
|
|
|
|
ircd::m::fetch::reflect(const op &op)
|
2019-05-17 17:18:31 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
switch(op)
|
2019-05-17 17:18:31 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
case op::noop: return "noop";
|
2019-08-30 04:29:40 +02:00
|
|
|
case op::auth: return "auth";
|
2019-08-30 06:48:47 +02:00
|
|
|
case op::event: return "event";
|
|
|
|
case op::backfill: return "backfill";
|
2019-05-17 17:18:31 +02:00
|
|
|
}
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
return "?????";
|
2019-05-17 17:18:31 +02:00
|
|
|
}
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
//
|
|
|
|
// internal
|
|
|
|
//
|
|
|
|
|
2019-04-11 06:16:00 +02:00
|
|
|
//
|
|
|
|
// request worker
|
|
|
|
//
|
|
|
|
|
|
|
|
void
|
|
|
|
ircd::m::fetch::request_worker()
|
|
|
|
try
|
|
|
|
{
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
dock.wait([]
|
|
|
|
{
|
|
|
|
return std::any_of(begin(requests), end(requests), []
|
2019-08-27 00:12:43 +02:00
|
|
|
(const auto &request)
|
2019-04-11 06:16:00 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
return !request.finished;
|
2019-04-11 06:16:00 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
request_handle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(const std::exception &e)
|
|
|
|
{
|
|
|
|
log::critical
|
|
|
|
{
|
|
|
|
log, "fetch request worker :%s",
|
|
|
|
e.what()
|
|
|
|
};
|
|
|
|
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
|
2019-08-27 00:12:43 +02:00
|
|
|
void
|
|
|
|
ircd::m::fetch::request_handle()
|
2019-04-11 08:29:56 +02:00
|
|
|
{
|
2019-08-27 00:12:43 +02:00
|
|
|
std::unique_lock lock
|
2019-04-11 08:29:56 +02:00
|
|
|
{
|
2019-08-27 00:12:43 +02:00
|
|
|
requests_mutex
|
|
|
|
};
|
2019-04-12 22:03:08 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
const scope_notify notify
|
|
|
|
{
|
|
|
|
fetch::dock
|
|
|
|
};
|
|
|
|
|
|
|
|
static const auto dereferencer{[]
|
|
|
|
(auto &it) -> server::request &
|
|
|
|
{
|
2019-09-09 02:11:28 +02:00
|
|
|
// If the request doesn't have a server::request future attached
|
|
|
|
// during this pass we reference this default constructed static
|
|
|
|
// instance which when_any() will treat as a no-op.
|
|
|
|
static server::request request_skip;
|
2019-09-04 07:14:53 +02:00
|
|
|
auto &request(mutable_cast(*it));
|
2019-09-09 02:11:28 +02:00
|
|
|
return request.future?
|
|
|
|
*request.future:
|
|
|
|
request_skip;
|
2019-08-30 03:30:47 +02:00
|
|
|
}};
|
2019-04-11 08:29:56 +02:00
|
|
|
|
2019-04-11 06:16:00 +02:00
|
|
|
auto next
|
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
ctx::when_any(requests.begin(), requests.end(), dereferencer)
|
2019-04-11 06:16:00 +02:00
|
|
|
};
|
|
|
|
|
2019-09-04 02:05:52 +02:00
|
|
|
bool timedout{true};
|
2019-04-11 06:16:00 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
const unlock_guard unlock
|
|
|
|
{
|
|
|
|
lock
|
|
|
|
};
|
|
|
|
|
2019-09-04 02:05:52 +02:00
|
|
|
timedout = !next.wait(seconds(timeout), std::nothrow);
|
2019-08-27 00:12:43 +02:00
|
|
|
};
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2019-09-04 02:05:52 +02:00
|
|
|
if(likely(!timedout))
|
2019-04-11 06:16:00 +02:00
|
|
|
{
|
2019-09-04 02:05:52 +02:00
|
|
|
const auto it
|
|
|
|
{
|
|
|
|
next.get()
|
|
|
|
};
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2019-09-04 02:05:52 +02:00
|
|
|
if(it != end(requests))
|
|
|
|
if(!request_handle(it))
|
|
|
|
return;
|
|
|
|
}
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2019-09-04 02:05:52 +02:00
|
|
|
request_cleanup();
|
2019-04-11 06:16:00 +02:00
|
|
|
}
|
|
|
|
|
2019-09-04 02:05:52 +02:00
|
|
|
bool
|
2019-04-11 06:16:00 +02:00
|
|
|
ircd::m::fetch::request_handle(const decltype(requests)::iterator &it)
|
|
|
|
{
|
|
|
|
auto &request
|
|
|
|
{
|
2019-09-04 02:05:52 +02:00
|
|
|
mutable_cast(*it)
|
2019-04-11 06:16:00 +02:00
|
|
|
};
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
if(!request.finished)
|
|
|
|
if(!handle(request))
|
2019-09-04 02:05:52 +02:00
|
|
|
return false;
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2019-08-27 00:12:43 +02:00
|
|
|
requests.erase(it);
|
2019-09-04 02:05:52 +02:00
|
|
|
return true;
|
2019-04-11 06:16:00 +02:00
|
|
|
}
|
|
|
|
|
2019-08-27 00:12:43 +02:00
|
|
|
size_t
|
|
|
|
ircd::m::fetch::request_cleanup()
|
2019-09-04 02:05:52 +02:00
|
|
|
try
|
2019-04-11 06:16:00 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
const auto now
|
|
|
|
{
|
|
|
|
ircd::now<system_point>()
|
|
|
|
};
|
|
|
|
|
2019-08-27 00:12:43 +02:00
|
|
|
size_t ret(0);
|
|
|
|
for(auto it(begin(requests)); it != end(requests); ++it)
|
2019-04-11 06:16:00 +02:00
|
|
|
{
|
2019-09-04 02:05:52 +02:00
|
|
|
auto &request(mutable_cast(*it));
|
2022-07-05 02:47:47 +02:00
|
|
|
if(!!request.finished || !request.promise)
|
2020-11-28 03:17:12 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
else if(!request.started)
|
2019-08-27 00:12:43 +02:00
|
|
|
start(request);
|
2019-04-11 08:29:56 +02:00
|
|
|
|
2022-07-05 02:47:47 +02:00
|
|
|
else if(timedout(request, now))
|
2019-08-27 00:12:43 +02:00
|
|
|
retry(request);
|
|
|
|
}
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
auto it(begin(requests)); while(it != end(requests))
|
2019-04-11 06:16:00 +02:00
|
|
|
{
|
2019-09-04 02:05:52 +02:00
|
|
|
auto &request(mutable_cast(*it));
|
2022-07-05 02:47:47 +02:00
|
|
|
if(!!request.finished || !request.promise)
|
2019-08-27 00:12:43 +02:00
|
|
|
{
|
|
|
|
it = requests.erase(it);
|
|
|
|
++ret;
|
|
|
|
}
|
|
|
|
else ++it;
|
|
|
|
}
|
2019-04-12 12:36:03 +02:00
|
|
|
|
2019-08-27 00:12:43 +02:00
|
|
|
return ret;
|
2019-04-11 06:16:00 +02:00
|
|
|
}
|
2019-09-04 02:05:52 +02:00
|
|
|
catch(const std::exception &e)
|
|
|
|
{
|
|
|
|
log::critical
|
|
|
|
{
|
2023-02-18 02:22:53 +01:00
|
|
|
log, "request_cleanup() :%s",
|
2019-09-04 02:05:52 +02:00
|
|
|
e.what(),
|
|
|
|
};
|
|
|
|
|
|
|
|
throw;
|
|
|
|
}
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2018-09-05 08:27:01 +02:00
|
|
|
//
|
|
|
|
// fetch::request
|
|
|
|
//
|
|
|
|
|
2019-04-12 14:29:12 +02:00
|
|
|
bool
|
2019-09-16 21:21:20 +02:00
|
|
|
ircd::m::fetch::start(request &request)
|
|
|
|
try
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2022-07-05 02:47:47 +02:00
|
|
|
assert(request.promise);
|
2019-08-30 03:30:47 +02:00
|
|
|
assert(!request.finished);
|
2020-10-29 12:47:23 +01:00
|
|
|
|
|
|
|
// Attempt the user's hint first
|
2020-11-07 06:59:52 +01:00
|
|
|
if(!request.started && !request.origin && request.opts.hint)
|
|
|
|
if(proffer_remote(request, request.opts.hint))
|
|
|
|
select_remote(request, request.opts.hint);
|
2019-08-30 04:28:37 +02:00
|
|
|
|
2020-10-29 12:47:23 +01:00
|
|
|
// When no user hint, use legacy event_id hostpart as hint.
|
|
|
|
if(!request.started && !request.origin)
|
|
|
|
if(proffer_remote(request, request.opts.event_id.host()))
|
2020-11-07 06:57:38 +01:00
|
|
|
select_remote(request, request.opts.event_id.host());
|
2020-10-29 12:47:23 +01:00
|
|
|
|
2020-11-07 11:41:17 +01:00
|
|
|
if(!!request.started)
|
|
|
|
if(!request.opts.attempt_limit || request.attempted.size() < request.opts.attempt_limit)
|
|
|
|
select_random_remote(request);
|
|
|
|
|
2020-11-08 15:38:45 +01:00
|
|
|
if(!request.started && !request.origin)
|
|
|
|
select_random_remote(request);
|
|
|
|
|
2019-08-27 00:12:43 +02:00
|
|
|
if(!request.started)
|
2019-08-30 03:30:47 +02:00
|
|
|
request.started = ircd::now<system_point>();
|
2019-08-27 00:12:43 +02:00
|
|
|
|
2020-11-07 11:41:17 +01:00
|
|
|
while(request.origin)
|
2019-08-27 00:12:43 +02:00
|
|
|
{
|
2022-07-09 23:14:04 +02:00
|
|
|
if(unlikely(!request.promise))
|
|
|
|
throw ctx::broken_promise
|
|
|
|
{
|
|
|
|
"Fetch interrupted."
|
|
|
|
};
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
if(start(request, request.origin))
|
2019-08-27 00:12:43 +02:00
|
|
|
return true;
|
2019-04-16 02:18:31 +02:00
|
|
|
|
2020-11-07 11:41:17 +01:00
|
|
|
if(request.opts.attempt_limit)
|
|
|
|
if(request.attempted.size() >= request.opts.attempt_limit)
|
|
|
|
break;
|
|
|
|
|
|
|
|
select_random_remote(request);
|
2019-08-27 00:12:43 +02:00
|
|
|
}
|
|
|
|
|
2019-09-16 21:36:38 +02:00
|
|
|
throw m::NOT_FOUND
|
|
|
|
{
|
|
|
|
"Cannot find any server to fetch %s in %s in %zu attempts",
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
|
|
|
request.attempted.size(),
|
|
|
|
};
|
2019-08-27 00:12:43 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
assert(!request.finished);
|
|
|
|
request.eptr = std::current_exception();
|
|
|
|
finish(request);
|
|
|
|
return false;
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
|
|
|
|
2019-04-12 14:29:12 +02:00
|
|
|
bool
|
2019-04-12 12:13:40 +02:00
|
|
|
ircd::m::fetch::start(request &request,
|
2019-08-30 03:30:47 +02:00
|
|
|
const string_view &remote)
|
2019-04-12 14:29:12 +02:00
|
|
|
try
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2019-09-11 03:02:26 +02:00
|
|
|
if(unlikely(run::level != run::level::RUN))
|
|
|
|
throw m::UNAVAILABLE
|
|
|
|
{
|
2020-05-12 06:32:48 +02:00
|
|
|
"Cannot start fetch requests in runlevel."
|
2019-09-11 03:02:26 +02:00
|
|
|
};
|
|
|
|
|
2022-07-05 02:47:47 +02:00
|
|
|
assert(request.promise);
|
|
|
|
assert(!request.finished);
|
2019-08-30 03:30:47 +02:00
|
|
|
request.last = ircd::now<system_point>();
|
2019-04-12 12:13:40 +02:00
|
|
|
if(!request.started)
|
2019-08-30 03:30:47 +02:00
|
|
|
request.started = request.last;
|
2018-09-05 08:27:01 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
switch(request.opts.op)
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2019-08-30 06:48:47 +02:00
|
|
|
case op::noop:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op::auth:
|
|
|
|
{
|
2020-03-06 04:35:20 +01:00
|
|
|
fed::event_auth::opts opts;
|
2019-08-30 06:48:47 +02:00
|
|
|
opts.remote = remote;
|
2020-03-06 04:35:20 +01:00
|
|
|
request.future = std::make_unique<fed::event_auth>
|
2019-08-30 06:48:47 +02:00
|
|
|
(
|
|
|
|
request.opts.room_id,
|
|
|
|
request.opts.event_id,
|
|
|
|
request.buf,
|
|
|
|
std::move(opts)
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
case op::event:
|
2019-07-14 02:18:53 +02:00
|
|
|
{
|
2020-03-06 04:35:20 +01:00
|
|
|
fed::event::opts opts;
|
2019-08-30 03:30:47 +02:00
|
|
|
opts.remote = remote;
|
2020-03-06 04:35:20 +01:00
|
|
|
request.future = std::make_unique<fed::event>
|
2019-08-30 03:30:47 +02:00
|
|
|
(
|
|
|
|
request.opts.event_id,
|
|
|
|
request.buf,
|
|
|
|
std::move(opts)
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-08-30 06:48:47 +02:00
|
|
|
case op::backfill:
|
2019-08-30 04:29:40 +02:00
|
|
|
{
|
2020-03-06 04:35:20 +01:00
|
|
|
fed::backfill::opts opts;
|
2019-08-30 04:29:40 +02:00
|
|
|
opts.remote = remote;
|
2019-09-16 21:12:43 +02:00
|
|
|
opts.limit = request.opts.backfill_limit;
|
|
|
|
opts.limit = opts.limit?: size_t(backfill_limit_default);
|
2019-08-30 06:48:47 +02:00
|
|
|
opts.event_id = request.opts.event_id;
|
2020-03-06 04:35:20 +01:00
|
|
|
request.future = std::make_unique<fed::backfill>
|
2019-08-30 04:29:40 +02:00
|
|
|
(
|
|
|
|
request.opts.room_id,
|
|
|
|
request.buf,
|
|
|
|
std::move(opts)
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2019-07-14 02:18:53 +02:00
|
|
|
}
|
2019-04-11 06:16:00 +02:00
|
|
|
|
|
|
|
log::debug
|
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
log, "Starting %s request for %s in %s from '%s'",
|
|
|
|
reflect(request.opts.op),
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
2019-04-12 12:13:40 +02:00
|
|
|
string_view{request.origin},
|
2019-04-11 06:16:00 +02:00
|
|
|
};
|
2019-04-12 12:13:40 +02:00
|
|
|
|
|
|
|
dock.notify_all();
|
2019-04-12 14:29:12 +02:00
|
|
|
return true;
|
|
|
|
}
|
2019-09-11 03:02:26 +02:00
|
|
|
catch(const m::UNAVAILABLE &e)
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
}
|
2020-03-09 17:40:05 +01:00
|
|
|
catch(const ctx::interrupted &e)
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
}
|
2019-04-24 04:08:12 +02:00
|
|
|
catch(const http::error &e)
|
2019-04-12 14:29:12 +02:00
|
|
|
{
|
2020-03-09 17:29:17 +01:00
|
|
|
log::derror
|
2019-04-12 23:26:10 +02:00
|
|
|
{
|
2020-03-09 17:29:17 +01:00
|
|
|
log, "Starting %s request for %s in %s to '%s' :%s %s",
|
2019-08-30 03:30:47 +02:00
|
|
|
reflect(request.opts.op),
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
2019-04-24 04:08:12 +02:00
|
|
|
string_view{request.origin},
|
|
|
|
e.what(),
|
|
|
|
e.content,
|
2019-04-12 23:26:10 +02:00
|
|
|
};
|
|
|
|
|
2019-04-24 04:08:12 +02:00
|
|
|
return false;
|
|
|
|
}
|
2020-03-09 17:29:17 +01:00
|
|
|
catch(const server::error &e)
|
|
|
|
{
|
|
|
|
log::derror
|
|
|
|
{
|
|
|
|
log, "Starting %s request for %s in %s to '%s' :%s",
|
|
|
|
reflect(request.opts.op),
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
|
|
|
string_view{request.origin},
|
|
|
|
e.what(),
|
|
|
|
};
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2019-04-24 04:08:12 +02:00
|
|
|
catch(const std::exception &e)
|
|
|
|
{
|
2020-03-09 17:29:17 +01:00
|
|
|
log::error
|
2019-04-12 14:29:12 +02:00
|
|
|
{
|
2020-03-09 17:29:17 +01:00
|
|
|
log, "Starting %s request for %s in %s to '%s' :%s",
|
2019-08-30 03:30:47 +02:00
|
|
|
reflect(request.opts.op),
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
2019-04-12 14:29:12 +02:00
|
|
|
string_view{request.origin},
|
|
|
|
e.what()
|
|
|
|
};
|
|
|
|
|
|
|
|
return false;
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
|
|
|
|
2020-10-29 12:41:11 +01:00
|
|
|
bool
|
|
|
|
ircd::m::fetch::select_random_remote(request &request)
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2020-10-29 12:41:11 +01:00
|
|
|
// Tests if remote is potentially viable
|
|
|
|
const auto proffer{[&request](const string_view &remote)
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2020-10-29 12:41:11 +01:00
|
|
|
return proffer_remote(request, remote);
|
|
|
|
}};
|
2018-09-05 08:27:01 +02:00
|
|
|
|
2020-10-29 12:41:11 +01:00
|
|
|
// copies randomly selected remote into the attempted set.
|
|
|
|
const auto closure{[&request](const string_view &remote)
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2020-10-29 12:41:11 +01:00
|
|
|
select_remote(request, remote);
|
2018-09-05 08:27:01 +02:00
|
|
|
}};
|
|
|
|
|
2020-10-29 12:41:11 +01:00
|
|
|
const m::room::origins origins
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2020-10-29 12:41:11 +01:00
|
|
|
request.opts.room_id
|
|
|
|
};
|
2018-09-05 08:27:01 +02:00
|
|
|
|
2020-10-21 09:02:56 +02:00
|
|
|
// Select a random server in the room
|
2019-04-25 15:45:03 +02:00
|
|
|
request.origin = {};
|
2020-10-29 12:41:11 +01:00
|
|
|
if(origins.random(closure, proffer))
|
|
|
|
return true;
|
2020-10-21 09:02:56 +02:00
|
|
|
|
|
|
|
// If nothing found attempt hosts from mxids
|
2020-10-29 12:47:23 +01:00
|
|
|
const string_view mxid[2]
|
2020-10-21 09:02:56 +02:00
|
|
|
{
|
2020-10-29 12:47:23 +01:00
|
|
|
request.opts.event_id.host(),
|
|
|
|
request.opts.room_id.host(),
|
2020-10-29 12:41:11 +01:00
|
|
|
};
|
2020-10-21 09:02:56 +02:00
|
|
|
|
2020-10-29 12:47:23 +01:00
|
|
|
for(const auto &remote : mxid)
|
|
|
|
if(proffer_remote(request, remote))
|
|
|
|
if(select_remote(request, remote))
|
|
|
|
return true;
|
2020-10-21 09:02:56 +02:00
|
|
|
|
2020-10-29 12:41:11 +01:00
|
|
|
return false;
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
|
|
|
|
2020-10-29 12:41:11 +01:00
|
|
|
bool
|
|
|
|
ircd::m::fetch::select_remote(request &request,
|
|
|
|
const string_view &remote)
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2020-10-29 12:41:11 +01:00
|
|
|
const auto it
|
|
|
|
{
|
|
|
|
request.attempted.lower_bound(remote)
|
|
|
|
};
|
|
|
|
|
|
|
|
if(it != request.attempted.end() && *it == remote)
|
|
|
|
return false;
|
|
|
|
|
2018-09-05 08:27:01 +02:00
|
|
|
const auto iit
|
|
|
|
{
|
2020-10-29 12:41:11 +01:00
|
|
|
request.attempted.emplace_hint(it, remote)
|
2018-09-05 08:27:01 +02:00
|
|
|
};
|
|
|
|
|
2020-10-29 12:41:11 +01:00
|
|
|
request.origin = *iit;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ircd::m::fetch::proffer_remote(request &request,
|
|
|
|
const string_view &remote)
|
|
|
|
{
|
2020-10-29 12:47:23 +01:00
|
|
|
// Case sentinel false.
|
|
|
|
if(!remote)
|
|
|
|
return false;
|
|
|
|
|
2020-10-29 12:41:11 +01:00
|
|
|
// Don't want to request from myself.
|
|
|
|
if(my_host(remote))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Don't want to use a peer we already tried and failed with.
|
|
|
|
if(request.attempted.count(remote))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Don't want to use a peer marked with an error by ircd::server
|
|
|
|
if(fed::errant(remote))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
|
|
|
|
2018-10-23 18:13:48 +02:00
|
|
|
bool
|
2019-04-12 12:13:40 +02:00
|
|
|
ircd::m::fetch::handle(request &request)
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
if(likely(request.future))
|
|
|
|
handle_result(request);
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2022-07-05 02:47:47 +02:00
|
|
|
if(!request.eptr || !request.promise)
|
2019-08-30 03:30:47 +02:00
|
|
|
finish(request);
|
|
|
|
else
|
|
|
|
retry(request);
|
2019-08-28 02:36:14 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
return !!request.finished;
|
|
|
|
}
|
2019-08-28 02:36:14 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
void
|
|
|
|
ircd::m::fetch::handle_result(request &request)
|
|
|
|
try
|
|
|
|
{
|
2022-07-05 02:47:47 +02:00
|
|
|
assert(request.future);
|
2019-08-30 03:30:47 +02:00
|
|
|
const auto code
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
request.future->get()
|
|
|
|
};
|
2019-04-11 06:16:00 +02:00
|
|
|
|
2022-07-05 02:47:47 +02:00
|
|
|
const string_view content
|
2019-08-30 03:30:47 +02:00
|
|
|
{
|
|
|
|
request.future->in.content
|
|
|
|
};
|
2018-09-05 08:27:01 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
check_response(request, content);
|
2022-07-05 02:47:47 +02:00
|
|
|
if(unlikely(!request.promise))
|
|
|
|
throw ctx::broken_promise
|
|
|
|
{
|
|
|
|
"Fetch response check interrupted."
|
|
|
|
};
|
2019-08-30 03:30:47 +02:00
|
|
|
|
2022-07-05 02:47:47 +02:00
|
|
|
assert(request.promise);
|
2019-08-30 03:30:47 +02:00
|
|
|
char pbuf[48];
|
|
|
|
log::debug
|
|
|
|
{
|
|
|
|
log, "Received %u %s good %s %s in %s from '%s' %s",
|
|
|
|
uint(code),
|
|
|
|
status(code),
|
|
|
|
reflect(request.opts.op),
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
|
|
|
string_view{request.origin},
|
|
|
|
pretty(pbuf, iec(size(content))),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
request.eptr = std::current_exception();
|
2018-10-23 18:13:48 +02:00
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
log::derror
|
|
|
|
{
|
2019-09-08 00:10:28 +02:00
|
|
|
log, "%s error for %s %s in %s :%s",
|
|
|
|
string_view{request.origin},
|
2019-08-30 03:30:47 +02:00
|
|
|
reflect(request.opts.op),
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
|
|
|
what(request.eptr),
|
|
|
|
};
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-04-12 12:13:40 +02:00
|
|
|
ircd::m::fetch::retry(request &request)
|
2018-09-05 08:27:01 +02:00
|
|
|
try
|
|
|
|
{
|
2022-07-05 02:47:47 +02:00
|
|
|
assert(request.promise);
|
2019-04-16 00:26:52 +02:00
|
|
|
assert(!request.finished);
|
2019-08-30 03:30:47 +02:00
|
|
|
assert(!!request.started && !!request.last);
|
2019-08-27 00:12:43 +02:00
|
|
|
|
2019-09-04 07:14:53 +02:00
|
|
|
if(request.future)
|
|
|
|
{
|
|
|
|
server::cancel(*request.future);
|
|
|
|
request.future.reset(nullptr);
|
|
|
|
}
|
|
|
|
|
2019-04-12 12:13:40 +02:00
|
|
|
request.eptr = std::exception_ptr{};
|
|
|
|
request.origin = {};
|
|
|
|
start(request);
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2019-04-12 12:13:40 +02:00
|
|
|
request.eptr = std::current_exception();
|
|
|
|
finish(request);
|
2018-06-03 19:02:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-04-12 12:13:40 +02:00
|
|
|
ircd::m::fetch::finish(request &request)
|
2018-09-05 08:27:01 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
request.finished = ircd::now<system_point>();
|
2019-08-27 00:12:43 +02:00
|
|
|
|
2023-02-09 19:54:24 +01:00
|
|
|
if constexpr((false))
|
|
|
|
log::logf
|
|
|
|
{
|
|
|
|
log, request.eptr? log::DERROR: log::DEBUG,
|
|
|
|
"Finished %s in %s started:%ld finished:%d attempted:%zu abandon:%b %s%s",
|
|
|
|
string_view{request.opts.event_id},
|
|
|
|
string_view{request.opts.room_id},
|
|
|
|
duration_cast<seconds>(tse(request.started)).count(),
|
|
|
|
duration_cast<seconds>(tse(request.finished)).count(),
|
|
|
|
request.attempted.size(),
|
|
|
|
!request.promise,
|
|
|
|
request.eptr? " :" : "",
|
|
|
|
what(request.eptr),
|
|
|
|
};
|
2019-08-27 00:12:43 +02:00
|
|
|
|
|
|
|
if(!request.promise)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(request.eptr)
|
|
|
|
{
|
|
|
|
request.promise.set_exception(std::move(request.eptr));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-30 03:30:47 +02:00
|
|
|
result res;
|
|
|
|
res.buf = std::move(request.future->in.dynamic);
|
|
|
|
res.content = res.buf;
|
2020-11-22 01:55:09 +01:00
|
|
|
strlcpy(res.origin, request.origin);
|
2022-07-05 02:47:47 +02:00
|
|
|
assert(request.origin == res.origin);
|
2019-08-30 03:30:47 +02:00
|
|
|
request.promise.set_value(std::move(res));
|
2018-09-05 08:27:01 +02:00
|
|
|
}
|
2019-04-12 12:13:40 +02:00
|
|
|
|
2019-04-15 20:37:13 +02:00
|
|
|
bool
|
|
|
|
ircd::m::fetch::timedout(const request &request,
|
2019-08-30 03:30:47 +02:00
|
|
|
const system_point &now)
|
2019-04-15 20:37:13 +02:00
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
assert(!!request.started && !request.finished && !!request.last);
|
|
|
|
return request.last + seconds(timeout) < now;
|
2019-04-15 20:37:13 +02:00
|
|
|
}
|
|
|
|
|
2019-04-12 12:13:40 +02:00
|
|
|
bool
|
2019-08-31 10:53:58 +02:00
|
|
|
ircd::m::fetch::operator<(const request &a, const request &b)
|
|
|
|
noexcept
|
|
|
|
{
|
|
|
|
return a.opts < b.opts;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ircd::m::fetch::operator<(const opts &a, const request &b)
|
|
|
|
noexcept
|
|
|
|
{
|
|
|
|
return a < b.opts;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ircd::m::fetch::operator<(const request &a, const opts &b)
|
|
|
|
noexcept
|
|
|
|
{
|
|
|
|
return a.opts < b;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ircd::m::fetch::operator<(const opts &a, const opts &b)
|
|
|
|
noexcept
|
|
|
|
{
|
2019-09-04 07:14:53 +02:00
|
|
|
if(uint(a.op) < uint(b.op))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else if(uint(a.op) > uint(b.op))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
else if(a.room_id < b.room_id)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else if(a.room_id > b.room_id)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
else if(a.event_id < b.event_id)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else if(a.event_id > b.event_id)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
assert(operator==(a, b));
|
|
|
|
return false;
|
2019-08-31 10:53:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ircd::m::fetch::operator==(const request &a, const request &b)
|
|
|
|
noexcept
|
|
|
|
{
|
|
|
|
return a.opts == b.opts;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ircd::m::fetch::operator==(const opts &a, const request &b)
|
2019-04-12 12:13:40 +02:00
|
|
|
noexcept
|
|
|
|
{
|
2019-08-31 10:53:58 +02:00
|
|
|
return a == b.opts;
|
2019-04-12 12:13:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2019-08-31 10:53:58 +02:00
|
|
|
ircd::m::fetch::operator==(const request &a, const opts &b)
|
2019-04-12 12:13:40 +02:00
|
|
|
noexcept
|
|
|
|
{
|
2019-08-31 10:53:58 +02:00
|
|
|
return a.opts == b;
|
2019-04-12 12:13:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2019-08-31 10:53:58 +02:00
|
|
|
ircd::m::fetch::operator==(const opts &a, const opts &b)
|
2019-04-12 12:13:40 +02:00
|
|
|
noexcept
|
|
|
|
{
|
2019-08-31 10:53:58 +02:00
|
|
|
return uint(a.op) == uint(b.op) &&
|
|
|
|
a.event_id == b.event_id &&
|
|
|
|
a.room_id == b.room_id;
|
2019-04-12 12:13:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// request::request
|
|
|
|
//
|
|
|
|
|
2022-07-04 00:05:45 +02:00
|
|
|
ircd::m::fetch::request::request(fetch::opts opts)
|
2019-08-30 03:30:47 +02:00
|
|
|
:opts
|
2019-04-12 12:13:40 +02:00
|
|
|
{
|
2022-07-04 00:05:45 +02:00
|
|
|
std::move(opts)
|
2019-04-12 12:13:40 +02:00
|
|
|
}
|
2019-08-30 03:30:47 +02:00
|
|
|
,buf
|
2019-08-27 00:12:43 +02:00
|
|
|
{
|
2022-07-04 00:05:45 +02:00
|
|
|
this->opts.bufsz?: 16_KiB
|
2019-08-27 00:12:43 +02:00
|
|
|
}
|
2019-08-30 03:30:47 +02:00
|
|
|
,event_id
|
|
|
|
{
|
2022-07-04 00:05:45 +02:00
|
|
|
this->opts.event_id
|
2019-08-30 03:30:47 +02:00
|
|
|
}
|
|
|
|
,room_id
|
2019-08-27 00:12:43 +02:00
|
|
|
{
|
2022-07-04 00:05:45 +02:00
|
|
|
this->opts.room_id
|
2019-08-27 00:12:43 +02:00
|
|
|
}
|
|
|
|
{
|
2019-08-30 03:30:47 +02:00
|
|
|
this->opts.event_id = this->event_id;
|
|
|
|
this->opts.room_id = this->room_id;
|
2019-08-27 00:12:43 +02:00
|
|
|
}
|
2019-09-03 23:43:34 +02:00
|
|
|
|
|
|
|
ircd::m::fetch::request::~request()
|
|
|
|
noexcept
|
|
|
|
{
|
2019-09-04 02:05:52 +02:00
|
|
|
//TODO: bad things unless this first here
|
|
|
|
future.reset(nullptr);
|
2019-09-03 23:43:34 +02:00
|
|
|
}
|