From 9aa6e2b7683ad2cd2d872e363c5e7d610da42ba8 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 6 Oct 2018 22:17:46 -0700 Subject: [PATCH] ircd::m: Rename most vm.notify hooks to vm.effect; Refactor vm::accept related. --- include/ircd/m/vm.h | 17 ------- ircd/m/m.cc | 20 -------- modules/client/directory/room.cc | 6 +-- modules/client/presence.cc | 7 +-- modules/client/profile.cc | 7 +-- modules/client/publicrooms.cc | 7 +-- modules/client/sync.cc | 74 +++++++++++++++++++++------- modules/client/sync.h | 41 +++++++++++++-- modules/console.cc | 10 ++-- modules/federation/sender.cc | 63 ++++++++++++++++------- modules/m_room_aliases.cc | 7 +-- modules/m_room_canonical_alias.cc | 7 +-- modules/m_room_create.cc | 7 +-- modules/m_room_history_visibility.cc | 7 +-- modules/m_room_join_rules.cc | 7 +-- modules/m_room_member.cc | 14 +++--- modules/s_conf.cc | 37 +++++++++----- modules/s_control.cc | 14 +++--- modules/s_keys.cc | 9 ++-- modules/s_listen.cc | 7 +-- modules/s_node.cc | 14 +++--- modules/vm.cc | 20 ++++---- 22 files changed, 249 insertions(+), 153 deletions(-) diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index 09098e797..50b382ad3 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -19,12 +19,10 @@ namespace ircd::m::vm struct opts; struct copts; struct eval; - struct accepted; enum fault :uint; using fault_t = std::underlying_type::type; extern log::log log; - extern ctx::shared_view accept; extern uint64_t current_sequence; extern const opts default_opts; extern const copts default_copts; @@ -244,21 +242,6 @@ struct ircd::m::vm::copts bool infolog_postcommit {false}; }; -struct ircd::m::vm::accepted -:m::event -{ - ctx::ctx *context; - const vm::opts *opts; - const vm::copts *copts; - const event::conforms *report; - shared_buffer strung; - - accepted(const m::event &event, - const vm::opts *const &opts, - const vm::copts *const &copts, - const event::conforms *const &report); -}; - struct ircd::m::vm::error :m::error { diff --git a/ircd/m/m.cc b/ircd/m/m.cc index 2c3efbbd7..de28a5a64 100644 --- a/ircd/m/m.cc +++ b/ircd/m/m.cc @@ -480,10 +480,6 @@ ircd::m::vm::log "vm", 'v' }; -decltype(ircd::m::vm::accept) -ircd::m::vm::accept -{}; - decltype(ircd::m::vm::current_sequence) ircd::m::vm::current_sequence {}; @@ -699,22 +695,6 @@ ircd::m::vm::eval::operator()(const event &event) return ret; } -// -// accepted -// - -ircd::m::vm::accepted::accepted(const m::event &event, - const vm::opts *const &opts, - const vm::copts *const &copts, - const event::conforms *const &report) -:m::event{event} -,context{ctx::current} -,opts{opts} -,copts{copts} -,report{report} -{ -} - /////////////////////////////////////////////////////////////////////////////// // // m/keys.h diff --git a/modules/client/directory/room.cc b/modules/client/directory/room.cc index 8a5dc6168..5880365ee 100644 --- a/modules/client/directory/room.cc +++ b/modules/client/directory/room.cc @@ -253,16 +253,16 @@ room_alias_fetch(const mutable_buffer &out, return response; } -const m::hookfn<> +const m::hookfn _create_alias_room { { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!ircd" }, { "type", "m.room.create" }, }, - [](const m::event &) + [](const m::event &, m::vm::eval &) { m::create(alias_room_id, m::me.user_id); } diff --git a/modules/client/presence.cc b/modules/client/presence.cc index e7119bafa..f924346cb 100644 --- a/modules/client/presence.cc +++ b/modules/client/presence.cc @@ -328,7 +328,8 @@ put__presence_status(client &client, } static void -handle_my_presence_changed(const m::event &event) +handle_my_presence_changed(const m::event &event, + m::vm::eval &eval) { if(!my(event)) return; @@ -349,12 +350,12 @@ handle_my_presence_changed(const m::event &event) } -const m::hookfn<> +const m::hookfn my_presence_changed { handle_my_presence_changed, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "ircd.presence" }, } }; diff --git a/modules/client/profile.cc b/modules/client/profile.cc index 35c234e09..b16ee3a33 100644 --- a/modules/client/profile.cc +++ b/modules/client/profile.cc @@ -366,7 +366,8 @@ handle_my_profile_changed__avatar_url(const m::event &event) } static void -handle_my_profile_changed(const m::event &event) +handle_my_profile_changed(const m::event &event, + m::vm::eval &eval) { if(!my(event)) return; @@ -389,12 +390,12 @@ handle_my_profile_changed(const m::event &event) return handle_my_profile_changed__avatar_url(event); } -const m::hookfn<> +const m::hookfn my_profile_changed { handle_my_profile_changed, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "ircd.profile" }, } }; diff --git a/modules/client/publicrooms.cc b/modules/client/publicrooms.cc index 25fb2c14b..09db7d4a7 100644 --- a/modules/client/publicrooms.cc +++ b/modules/client/publicrooms.cc @@ -323,7 +323,8 @@ post__publicrooms_remote(client &client, } static void -_create_public_room(const m::event &) +_create_public_room(const m::event &, + m::vm::eval &) { m::create(public_room_id, m::me.user_id); } @@ -331,12 +332,12 @@ _create_public_room(const m::event &) /// Create the public rooms room at the appropriate time on startup. /// The startup event chosen here is when @ircd joins the !ircd room, /// which is a fundamental notification toward the end of init. -const m::hookfn<> +const m::hookfn _create_public_hook { _create_public_room, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!ircd" }, { "type", "m.room.create" }, } diff --git a/modules/client/sync.cc b/modules/client/sync.cc index 97d6c50fd..911407593 100644 --- a/modules/client/sync.cc +++ b/modules/client/sync.cc @@ -130,29 +130,59 @@ catch(const bad_lex_cast &e) }; } +// +// longpoll +// + +decltype(ircd::m::sync::longpoll::notified) +ircd::m::sync::longpoll::notified +{ + handle_notify, + { + { "_site", "vm.notify" }, + } +}; + +void +ircd::m::sync::longpoll::handle_notify(const m::event &event, + m::vm::eval &eval) +{ + assert(eval.opts); + if(!eval.opts->notify_clients) + return; + + if(!polling) + return; + + queue.emplace_back(eval); + dock.notify_all(); +} + void ircd::m::sync::longpoll::poll(client &client, const args &args) try { - std::unique_lock lock + ++polling; + const unwind unpoll{[] { - m::vm::accept - }; + --polling; + }}; while(1) { - auto &accepted - { - m::vm::accept.wait_until(lock, args.timesout) - }; - - assert(accepted.opts); - if(!accepted.opts->notify_clients) + dock.wait_until(args.timesout); + if(queue.empty()) continue; - if(handle(client, args, accepted)) - return; + const auto &a(queue.front()); + const unwind pop{[] + { + queue.pop_front(); + }}; + + if(handle(client, args, a)) + break; } } catch(const ctx::timeout &e) @@ -178,7 +208,7 @@ catch(const ctx::timeout &e) bool ircd::m::sync::longpoll::handle(client &client, const args &args, - const vm::accepted &event) + const accepted &event) { const auto &room_id { @@ -197,7 +227,7 @@ ircd::m::sync::longpoll::handle(client &client, bool ircd::m::sync::longpoll::handle(client &client, const args &args, - const vm::accepted &event, + const accepted &event, const m::room &room) { const m::user::id &user_id @@ -261,7 +291,7 @@ ircd::m::sync::longpoll::sync_rooms(client &client, const m::user::id &user_id, const m::room &room, const args &args, - const vm::accepted &event) + const accepted &event) { std::vector r; std::vector m; @@ -290,7 +320,7 @@ std::string ircd::m::sync::longpoll::sync_room(client &client, const m::room &room, const args &args, - const vm::accepted &accepted) + const accepted &accepted) { const auto &since { @@ -302,12 +332,12 @@ ircd::m::sync::longpoll::sync_room(client &client, if(defined(json::get<"event_id"_>(event))) { json::strung strung(event); - if(accepted.copts && accepted.copts->client_txnid) + if(!!accepted.client_txnid) strung = json::insert(strung, json::member { "unsigned", json::members { - { "transaction_id", accepted.copts->client_txnid } + { "transaction_id", accepted.client_txnid } } }); @@ -401,6 +431,10 @@ ircd::m::sync::longpoll::sync_room(client &client, return json::strung(body); } +// +// linear +// + bool ircd::m::sync::linear::handle(client &client, shortpoll &sp, @@ -578,6 +612,10 @@ ircd::m::sync::linear::handle(client &client, return true; } +// +// polylog +// + bool ircd::m::sync::polylog::handle(client &client, shortpoll &sp, diff --git a/modules/client/sync.h b/modules/client/sync.h index 46190d432..387b6bd37 100644 --- a/modules/client/sync.h +++ b/modules/client/sync.h @@ -25,11 +25,44 @@ namespace ircd::m::sync namespace ircd::m::sync::longpoll { - static std::string sync_room(client &, const m::room &, const args &, const vm::accepted &); - static std::string sync_rooms(client &, const m::user::id &, const m::room &, const args &, const vm::accepted &); - static bool handle(client &, const args &, const vm::accepted &, const m::room &); - static bool handle(client &, const args &, const vm::accepted &); + struct accepted + :m::event + { + json::strung strung; + std::string client_txnid; + + accepted(const m::vm::eval &eval) + :strung + { + *eval.event_ + } + ,client_txnid + { + eval.copts? + eval.copts->client_txnid: + string_view{} + } + { + const json::object object{this->strung}; + static_cast(*this) = m::event{object}; + } + + accepted(accepted &&) = default; + accepted(const accepted &) = delete; + }; + + size_t polling {0}; + std::deque queue; + ctx::dock dock; + + static std::string sync_room(client &, const m::room &, const args &, const accepted &); + static std::string sync_rooms(client &, const m::user::id &, const m::room &, const args &, const accepted &); + static bool handle(client &, const args &, const accepted &, const m::room &); + static bool handle(client &, const args &, const accepted &); static void poll(client &, const args &); + + static void handle_notify(const m::event &, m::vm::eval &); + extern m::hookfn notified; } namespace ircd::m::sync::linear diff --git a/modules/console.cc b/modules/console.cc index ea6b2695b..741b2d223 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -4163,8 +4163,8 @@ console_cmd__stage__broadcast(opt &out, const string_view &line) { const m::vm::opts opts; const m::event event{stage.at(i)}; - m::vm::accepted a{event, &opts, nullptr, &opts.report}; - m::vm::accept(a); + //m::vm::accepted a{event, &opts, nullptr, &opts.report}; + //m::vm::accept(a); } return true; @@ -4477,12 +4477,14 @@ console_cmd__event__sign(opt &out, const string_view &line) if(op == "accept") { const m::vm::opts opts; +/* m::vm::accepted a { event, &opts, nullptr, &opts.report }; m::vm::accept(a); +*/ } else if(op == "eval") { @@ -7462,8 +7464,8 @@ console_cmd__feds__resend(opt &out, const string_view &line) }; const m::vm::opts opts; - m::vm::accepted a{event, &opts, nullptr, &opts.report}; - m::vm::accept(a); +// m::vm::accepted a{event, &opts, nullptr, &opts.report}; +// m::vm::accept(a); return true; } diff --git a/modules/federation/sender.cc b/modules/federation/sender.cc index d17cf21c6..2255ed1a3 100644 --- a/modules/federation/sender.cc +++ b/modules/federation/sender.cc @@ -26,6 +26,8 @@ static void send(const m::event &, const m::room::id &room_id); static void send(const m::event &); static void send_worker(); +static void handle_notify(const m::event &, m::vm::eval &); + context sender { @@ -51,32 +53,57 @@ IRCD_MODULE } }; +std::deque +notified_queue; + +ctx::dock +notified_dock; + +m::hookfn +notified +{ + handle_notify, + { + { "_site", "vm.notify" }, + } +}; + +void +handle_notify(const m::event &event, + m::vm::eval &eval) +{ + if(!my(event)) + return; + + assert(eval.opts); + if(!eval.opts->notify_servers) + return; + + notified_queue.emplace_back(json::strung{event}); + notified_dock.notify_all(); +} + void send_worker() { - // In order to synchronize with the vm core, this context has to - // maintain this shared_lock at all times. If this is unlocked we - // can miss an event being broadcast. - std::unique_lock lock - { - m::vm::accept - }; - while(1) try { - // reference to the event on the inserter's stack - const auto &event + notified_dock.wait([] { - m::vm::accept.wait(lock) + return !notified_queue.empty(); + }); + + const unwind pop{[] + { + assert(!notified_queue.empty()); + notified_queue.pop_front(); + }}; + + const m::event event + { + json::object{notified_queue.front()} }; - if(!my(event)) - continue; - - assert(event.opts); - if(!event.opts->notify_servers) - continue; - send(event); } catch(const std::exception &e) diff --git a/modules/m_room_aliases.cc b/modules/m_room_aliases.cc index b51354ae0..67a02f051 100644 --- a/modules/m_room_aliases.cc +++ b/modules/m_room_aliases.cc @@ -29,7 +29,8 @@ alias_room }; void -_changed_aliases(const m::event &event) +_changed_aliases(const m::event &event, + m::vm::eval &) { const m::room::id &room_id { @@ -61,12 +62,12 @@ _changed_aliases(const m::event &event) } } -const m::hookfn<> +const m::hookfn _changed_aliases_hookfn { _changed_aliases, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "m.room.aliases" }, } }; diff --git a/modules/m_room_canonical_alias.cc b/modules/m_room_canonical_alias.cc index a76d5a1b8..9a1514477 100644 --- a/modules/m_room_canonical_alias.cc +++ b/modules/m_room_canonical_alias.cc @@ -29,7 +29,8 @@ alias_room }; void -_changed_canonical_alias(const m::event &event) +_changed_canonical_alias(const m::event &event, + m::vm::eval &) { const m::room::alias &alias { @@ -57,12 +58,12 @@ _changed_canonical_alias(const m::event &event) }; } -const m::hookfn<> +const m::hookfn _changed_canonical_alias_hookfn { _changed_canonical_alias, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "m.room.canonical_alias" }, } }; diff --git a/modules/m_room_create.cc b/modules/m_room_create.cc index 5d5701041..dc14f755e 100644 --- a/modules/m_room_create.cc +++ b/modules/m_room_create.cc @@ -48,7 +48,8 @@ _can_create_room_hookfn }; static void -_created_room(const m::event &event) +_created_room(const m::event &event, + m::vm::eval &) { const m::room::id &room_id { @@ -64,12 +65,12 @@ _created_room(const m::event &event) send(m::my_room, at<"sender"_>(event), "ircd.room", room_id, json::object{}); } -const m::hookfn<> +const m::hookfn _created_room_hookfn { _created_room, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "m.room.create" }, } }; diff --git a/modules/m_room_history_visibility.cc b/modules/m_room_history_visibility.cc index 92b7876ac..3cc4d3b29 100644 --- a/modules/m_room_history_visibility.cc +++ b/modules/m_room_history_visibility.cc @@ -137,7 +137,8 @@ visible(const m::event &event, } static void -_changed_visibility(const m::event &event) +_changed_visibility(const m::event &event, + m::vm::eval &) { log::info { @@ -149,12 +150,12 @@ _changed_visibility(const m::event &event) }; } -const m::hookfn<> +const m::hookfn _changed_visibility_hookfn { _changed_visibility, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "m.room.history_visibility" }, } }; diff --git a/modules/m_room_join_rules.cc b/modules/m_room_join_rules.cc index f338991b8..c49947d16 100644 --- a/modules/m_room_join_rules.cc +++ b/modules/m_room_join_rules.cc @@ -17,7 +17,8 @@ IRCD_MODULE }; static void -_changed_rules(const m::event &event) +_changed_rules(const m::event &event, + m::vm::eval &) { const m::user::id &sender { @@ -40,12 +41,12 @@ _changed_rules(const m::event &event) send(public_room, sender, "ircd.room", room_id, json::strung{event}); } -const m::hookfn<> +const m::hookfn _changed_rules_hookfn { _changed_rules, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "m.room.join_rules" }, } }; diff --git a/modules/m_room_member.cc b/modules/m_room_member.cc index 33f1c1c4b..e37b62459 100644 --- a/modules/m_room_member.cc +++ b/modules/m_room_member.cc @@ -17,7 +17,8 @@ IRCD_MODULE }; static void -affect_user_room(const m::event &event) +affect_user_room(const m::event &event, + m::vm::eval &eval) { const auto &room_id { @@ -43,11 +44,11 @@ affect_user_room(const m::event &event) send(user_room, sender, "ircd.member", room_id, at<"content"_>(event)); } -const m::hookfn<> +const m::hookfn affect_user_room_hookfn { { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "m.room.member" }, }, affect_user_room @@ -72,16 +73,17 @@ _can_join_room_hookfn }; static void -_join_room(const m::event &event) +_join_room(const m::event &event, + m::vm::eval &eval) { } -const m::hookfn<> +const m::hookfn _join_room_hookfn { { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "type", "m.room.member" }, { "membership", "join" }, }, diff --git a/modules/s_conf.cc b/modules/s_conf.cc index 654150c42..5e00dd377 100644 --- a/modules/s_conf.cc +++ b/modules/s_conf.cc @@ -148,19 +148,26 @@ catch(const std::exception &e) }; } -const m::hookfn<> +static void +handle_conf_updated(const m::event &event, + m::vm::eval &) +{ + conf_updated(event); +} + +const m::hookfn conf_updated_hook { - conf_updated, + handle_conf_updated, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!conf" }, { "type", "ircd.conf.item" }, } }; static void -init_conf_items(const m::event &) +init_conf_items() { const m::room::state state { @@ -189,12 +196,19 @@ init_conf_item(conf::item<> &item) }); } -const m::hookfn<> +static void +handle_init_conf_items(const m::event &, + m::vm::eval &eval) +{ + init_conf_items(); +} + +const m::hookfn init_conf_items_hook { - init_conf_items, + handle_init_conf_items, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!ircd" }, { "type", "m.room.member" }, { "membership", "join" }, @@ -228,7 +242,8 @@ catch(const std::exception &e) } static void -create_conf_room(const m::event &) +create_conf_room(const m::event &, + m::vm::eval &) { m::create(conf_room_id, m::me.user_id); @@ -240,12 +255,12 @@ create_conf_room(const m::event &) } } -const m::hookfn<> +const m::hookfn create_conf_room_hook { create_conf_room, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!ircd" }, { "type", "m.room.create" }, } @@ -274,7 +289,7 @@ rehash_conf(const bool &existing) void reload_conf() { - init_conf_items(m::event{}); + init_conf_items(); } void diff --git a/modules/s_control.cc b/modules/s_control.cc index 18b60af6f..455ed8851 100644 --- a/modules/s_control.cc +++ b/modules/s_control.cc @@ -41,7 +41,8 @@ _cmd__die(const m::event &event, } static void -command_control(const m::event &event) +command_control(const m::event &event, + m::vm::eval &) noexcept try { const auto &content @@ -105,12 +106,12 @@ catch(const std::exception &e) notice(control_room, e.what()); } -const m::hookfn<> +const m::hookfn command_control_hook { command_control, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!control" }, { "type", "m.room.message" }, { "content", @@ -121,7 +122,8 @@ command_control_hook }; static void -create_control_room(const m::event &) +create_control_room(const m::event &, + m::vm::eval &) { create(control_room_id, m::me.user_id); join(control_room, m::me.user_id); @@ -134,12 +136,12 @@ create_control_room(const m::event &) notice(control_room, m::me.user_id, "I am the daemon. You can talk to me in this room by highlighting me."); } -const m::hookfn<> +const m::hookfn create_control_hook { create_control_room, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!ircd" }, { "type", "m.room.create" }, } diff --git a/modules/s_keys.cc b/modules/s_keys.cc index a16376da0..2cb9489f4 100644 --- a/modules/s_keys.cc +++ b/modules/s_keys.cc @@ -17,7 +17,7 @@ extern "C" bool verify__keys(const m::keys &) noexcept; extern "C" void get__keys(const string_view &server, const string_view &key_id, const m::keys::closure &); extern "C" bool query__keys(const string_view &query_server, const m::keys::queries &, const m::keys::closure_bool &); -extern "C" void create_my_key(const m::event &); +extern "C" void create_my_key(const m::event &, m::vm::eval &); static void init_my_ed25519(); static void init_my_tls_crt(); extern "C" void init_my_keys(); @@ -276,19 +276,20 @@ init_my_ed25519() }; } -const m::hookfn<> +const m::hookfn create_my_key_hook { create_my_key, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", m::my_node.room_id() }, { "type", "m.room.create" }, } }; void -create_my_key(const m::event &) +create_my_key(const m::event &, + m::vm::eval &) { const json::members verify_keys_ {{ diff --git a/modules/s_listen.cc b/modules/s_listen.cc index 3a58eda3e..825c6bbf1 100644 --- a/modules/s_listen.cc +++ b/modules/s_listen.cc @@ -80,18 +80,19 @@ init_listeners() // static void -create_listener(const m::event &event) +create_listener(const m::event &event, + m::vm::eval &) { load_listener(event); } /// Hook for a new listener description being sent. -const m::hookfn<> +const m::hookfn create_listener_hook { create_listener, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!ircd" }, { "type", "ircd.listen" }, } diff --git a/modules/s_node.cc b/modules/s_node.cc index 27117d53d..58119de8e 100644 --- a/modules/s_node.cc +++ b/modules/s_node.cc @@ -49,34 +49,36 @@ exists__nodeid(const m::node::id &node_id) } static void -create_my_node_room(const m::event &) +create_my_node_room(const m::event &, + m::vm::eval &) { create(m::my_node.room_id(), m::me.user_id); } -const m::hookfn<> +const m::hookfn create_my_node_hook { create_my_node_room, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!nodes" }, { "type", "m.room.create" }, } }; static void -create_nodes_room(const m::event &) +create_nodes_room(const m::event &, + m::vm::eval &) { create(nodes_room, m::me.user_id); } -const m::hookfn<> +const m::hookfn create_nodes_hook { create_nodes_room, { - { "_site", "vm.notify" }, + { "_site", "vm.effect" }, { "room_id", "!ircd" }, { "type", "m.room.create" }, } diff --git a/modules/vm.cc b/modules/vm.cc index 1b46a016d..676dfe26b 100644 --- a/modules/vm.cc +++ b/modules/vm.cc @@ -13,7 +13,8 @@ namespace ircd::m::vm extern hook::site commit_hook; ///< Called when this server issues event extern hook::site fetch_hook; ///< Called to resolve dependencies extern hook::site eval_hook; ///< Called when evaluating event - extern hook::site<> notify_hook; ///< Called after successful evaluation + extern hook::site notify_hook; ///< Called to broadcast successful eval + extern hook::site effect_hook; ///< Called to apply effects of eval static void write_commit(eval &); static fault _eval_edu(eval &, const event &); @@ -58,6 +59,12 @@ ircd::m::vm::notify_hook { "name", "vm.notify" } }; +decltype(ircd::m::vm::effect_hook) +ircd::m::vm::effect_hook +{ + { "name", "vm.effect" } +}; + // // init // @@ -466,16 +473,11 @@ try if(ret != fault::ACCEPT) return ret; - vm::accepted accepted - { - event, &opts, eval.copts, &report - }; + if(opts.notify) + notify_hook(event, eval); if(opts.effects) - notify_hook(event); - - if(opts.notify) - vm::accept(accepted); + effect_hook(event, eval); if(opts.debuglog_accept) log::debug