after-events-with-event hooks are rendered based on the priority, this means
when a rescan event happens, all the findDefinedTarget hooks(of different
session items) are run first and then all the findDefinedTarget hooks, so on.
This kind of scheduling of hooks was removing the established link between zoom
voice engine and digial mic. Also It is slightly difficult to follow the flow in
the logs.
Instead of arranging the hooks flately based on priority, better scheme to
prioritize them in two layers. First all the hooks for an event or session items
are grouped and with in that group, priority of the hook is honored.
src/scripts/policy-hooks.lua # modified: src/scripts/policy-node.lua #
- Sharpen the hooks, so that they are called only when needed.
- Make settings live, apply them when they are changed.
- Remove the state saver after events hook, call it directly.
- Remove the settings bookkeeping as the gobject properties.
- Remove the scheduling of default-nodes-changed signal via core.
after-events hooks are instantiated with rescan event, not with the event which
actually triggered it. after-events-with-event fills this gap.
policy-node clean needed this kind of hooks.
after-events hooks will get the original event triggering it, instead of the
rescan event.
after-events hook can register with any event, but it is called with rescan event
info. This is so because, after-events hook run after all the on-events hooks
are done with and as a part of the rescan event. so it is triggered with rescan
event data, which doesnt carry much info, instead of rescan event, it makes more
sense to call the after-events hook with the original event which triggered it.
This scheme provides for an orderly execution of hooks as the priorities
are controlled from one single place. Enumeration is defined in such a
way that new items can be added easily.
All the event hooks are changed to get the priorities from this
enumeration.
- Add a new variable "name" in WpEventHook and use it to log all the
hooks(by name) picked up in _push_event(). This gives a clear picture
if hook is registered for a given event.
- Form a name for an event and a chain of events for an event run, log
both of them. This gives a clear picture of the events executed and
order in which they are dispatched.
- Similarly build hooks chain and print it in _source_dispatch(), this
gives a clear picture of the hooks picked and the order in which they
are dispatched.
- Log only the dispatchable(with hooks) events, this de-clutters
the log messages.
- the source shouldn't become ready if there is nothing to do,
otherwise idle sources do not run (since they have lower priority)
- when the source becomes ready, we need a fd to wake up GLib's event
dispatching mechanism to continue processing, otherwise nothing happens