0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 00:02:34 +01:00

ircd:Ⓜ️ Pass fetch result origin as node_id to evals.

This commit is contained in:
Jason Volk 2020-11-21 17:13:18 -08:00
parent e06b033218
commit 595c51e17e
5 changed files with 16 additions and 8 deletions

View file

@ -41,7 +41,6 @@ ircd::m::acquire::acquire::acquire(const struct opts &opts)
head_vmopts.phase.set(m::vm::phase::NOTIFY, false);
head_vmopts.phase.set(m::vm::phase::FETCH_PREV, false);
head_vmopts.phase.set(m::vm::phase::FETCH_STATE, false);
head_vmopts.non_conform.set(event::conforms::MISMATCH_HASHES);
}
if(opts.state)
@ -49,7 +48,6 @@ ircd::m::acquire::acquire::acquire(const struct opts &opts)
state_vmopts.notify_servers = false;
state_vmopts.phase.set(m::vm::phase::FETCH_PREV, false);
state_vmopts.phase.set(m::vm::phase::FETCH_STATE, false);
state_vmopts.non_conform.set(event::conforms::MISMATCH_HASHES);
state_vmopts.wopts.appendix.set(dbs::appendix::ROOM_HEAD, false);
}
@ -59,7 +57,6 @@ ircd::m::acquire::acquire::acquire(const struct opts &opts)
history_vmopts.phase.set(m::vm::phase::NOTIFY, false);
history_vmopts.phase.set(m::vm::phase::FETCH_PREV, false);
history_vmopts.phase.set(m::vm::phase::FETCH_STATE, false);
history_vmopts.non_conform.set(event::conforms::MISMATCH_HASHES);
history_vmopts.wopts.appendix.set(dbs::appendix::ROOM_HEAD, false);
}
@ -520,8 +517,9 @@ try
log::debug
{
log, "Eval %zu for %s in %s",
log, "Eval %zu from '%s' for %s in %s",
pdus.size(),
string_view{response.origin},
string_view{result.event_id},
string_view{opts.room.room_id},
};
@ -535,9 +533,12 @@ try
|| result.vmopts == &this->state_vmopts
);
auto vmopts(*result.vmopts);
vmopts.node_id = response.origin;
m::vm::eval
{
pdus, *result.vmopts
pdus, vmopts
};
return true;

View file

@ -253,6 +253,7 @@ try
};
m::vm::opts vmopts;
vmopts.node_id = host;
vmopts.infolog_accept = false;
vmopts.warnlog &= ~vm::fault::EXISTS;
vmopts.nothrows = -1;

View file

@ -16,7 +16,7 @@ namespace ircd::m::vm::fetch
static void prev(const event &, vm::eval &, const room &);
static std::forward_list<ctx::future<m::fetch::result>> state_fetch(const event &, vm::eval &, const room &);
static void state(const event &, vm::eval &, const room &);
static void auth_chain_eval(const event &, vm::eval &, const room &, const json::array &);
static void auth_chain_eval(const event &, vm::eval &, const room &, const json::array &, const string_view &);
static void auth_chain(const event &, vm::eval &, const room &);
static void auth(const event &, vm::eval &, const room &);
static void handle(const event &, vm::eval &);
@ -315,7 +315,7 @@ try
response["auth_chain"]
};
auth_chain_eval(event, eval, room, auth_chain);
auth_chain_eval(event, eval, room, auth_chain, result.origin);
}
catch(const vm::error &e)
{
@ -338,7 +338,8 @@ void
ircd::m::vm::fetch::auth_chain_eval(const event &event,
vm::eval &eval,
const room &room,
const json::array &auth_chain)
const json::array &auth_chain,
const string_view &origin)
try
{
assert(eval.opts);
@ -347,6 +348,7 @@ try
opts.infolog_accept = true;
opts.warnlog &= ~vm::fault::EXISTS;
opts.notify_servers = false;
opts.node_id = origin;
log::debug
{
@ -471,6 +473,7 @@ try
auto opts(*eval.opts);
opts.phase.set(m::vm::phase::FETCH_PREV, false);
opts.phase.set(m::vm::phase::FETCH_STATE, false);
opts.node_id = result.origin;
opts.notify_servers = false;
// The result won't give us events with a content hash mismatch unless
@ -736,6 +739,7 @@ ircd::m::vm::fetch::prev(const event &event,
opts.phase.set(m::vm::phase::FETCH_PREV, false);
opts.phase.set(m::vm::phase::FETCH_STATE, false);
opts.notify_servers = false;
opts.node_id = result.origin;
log::debug
{
log, "%s fetched %zu pdus; evaluating...",

View file

@ -135,6 +135,7 @@ try
auto eval_opts(opts);
eval_opts.phase.set(vm::phase::FETCH_PREV, false);
eval_opts.phase.set(vm::phase::FETCH_STATE, false);
eval_opts.node_id = response.origin;
vm::eval
{
result, eval_opts

View file

@ -208,6 +208,7 @@ try
auto eval_opts(opts);
eval_opts.phase.set(vm::phase::FETCH_PREV, false);
eval_opts.phase.set(vm::phase::FETCH_STATE, false);
eval_opts.node_id = response.origin;
vm::eval
{
result, eval_opts