diff --git a/include/ircd/m/m.h b/include/ircd/m/m.h index 1817495b6..e202f4334 100644 --- a/include/ircd/m/m.h +++ b/include/ircd/m/m.h @@ -56,6 +56,7 @@ namespace ircd #include "get.h" #include "query.h" #include "dbs/dbs.h" +#include "hook.h" #include "vm.h" #include "invite_3pid.h" #include "createroom.h" @@ -80,7 +81,6 @@ namespace ircd #include "direct_to_device.h" #include "relates.h" #include "txn.h" -#include "hook.h" #include "visible.h" #include "redacted.h" #include "feds.h" diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index 20b0fb3c4..61708dcfc 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -83,11 +83,11 @@ struct ircd::m::vm::eval vector_view pdus; const json::iov *issue {nullptr}; const event *event_ {nullptr}; - string_view room_id; event::id::buf event_id; event::conforms report; string_view room_version; + const hook::base::site *phase {nullptr}; static bool for_each_pdu(const std::function &); static const event *find_pdu(const eval &, const event::id &); diff --git a/matrix/vm_execute.cc b/matrix/vm_execute.cc index 21cf7c18b..88970b3d9 100644 --- a/matrix/vm_execute.cc +++ b/matrix/vm_execute.cc @@ -667,6 +667,12 @@ try }; #endif + assert(!eval.phase); + const scope_restore hook_phase + { + eval.phase, std::addressof(hook) + }; + hook(event, std::forward(data)); #if 0 diff --git a/modules/console.cc b/modules/console.cc index 47ac8fe1f..f0f9f7ebe 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -14254,9 +14254,9 @@ console_cmd__vm(opt &out, const string_view &line) << std::right << std::setw(5) << "DONE" << " " << std::right << std::setw(9) << "SEQUENCE" << " " << std::right << std::setw(9) << "SEQSHARE" << " " - << std::right << std::setw(9) << "SEQSHARE" << " " - << std::right << std::setw(8) << "CELLS" << " " - << std::right << std::setw(8) << "SIZE" << " " + << std::left << std::setw(9) << "PHASE" << " " + << std::right << std::setw(6) << "SIZE" << " " + << std::right << std::setw(5) << "CELLS" << " " << std::right << std::setw(8) << "DEPTH" << " " << std::right << std::setw(5) << "VER" << " " << std::left << std::setw(40) << "ROOM ID" << " " @@ -14286,11 +14286,11 @@ console_cmd__vm(opt &out, const string_view &line) << std::right << std::setw(5) << eval->pdus.size() << " " << std::right << std::setw(5) << done << " " << std::right << std::setw(9) << eval->sequence << " " - << std::right << std::setw(9) << eval->sequence_shared[0] << " " - << std::right << std::setw(9) << eval->sequence_shared[1] << " " - << std::right << std::setw(8) << (eval->txn? eval->txn->size() : 0UL) << " " - << std::right << std::setw(8) << (eval->txn? eval->txn->bytes() : 0UL) << " " - << std::right << std::setw(8) << (eval->event_? long(json::get<"depth"_>(*eval->event_)) : -1L) << " " + << std::right << std::setw(9) << std::max(eval->sequence_shared[0], eval->sequence_shared[1]) << " " + << std::left << std::setw(9) << (eval->phase? eval->phase->name() : ""_sv) << " " + << std::right << std::setw(6) << (eval->txn? eval->txn->bytes() : 0UL) << " " + << std::right << std::setw(5) << (eval->txn? eval->txn->size() : 0UL) << " " + << std::right << std::setw(8) << (eval->event_ && eval->event_id? long(json::get<"depth"_>(*eval->event_)) : -1L) << " " << std::right << std::setw(5) << eval->room_version << " " << std::left << std::setw(40) << trunc(eval->room_id, 40) << " " << std::left << std::setw(60) << trunc(eval->event_id, 60) << " "