bridge: Don't stop introspecting immediately when a ObjectManager is detected
bridge: Don't stop introspecting immediately when a ObjectManager is detected

Doing this might violate the ordering guarantees.

A "watch" protocol call makes the guarantee that a "notify" message
will be send before the reply of the "watch" call (if the given watch
expression matches something, and if such a message hasn't already
been sent before the "watch" call).

This is implemented by creating a new batch with
cockpit_dbus_cache_poke and sending the reply in a barrier that runs
after that batch is completed.  The poke batch will do some
introspection and send the promised "notify" message if necessary.
However, the poke batch will skip this message if it is known that the
given object path is managed by a ObjectManager, under the assumption
that all necessary "notify" messages have already been sent in the
process of watching the ObjectManager.

This assumption is usually true, but not always: If the ObjectManager
is detected after the poke batch has been created, but before the poke
batch checks whether it can stop the introspection, the poke batch
will end (and the reply barrier will run), and the batch for
retrieving the ObjectManager information will run after that.

Thus, there will be no "notify" message before the "watch" reply
message.  It will come very soon after, when the ObjectManager batch
is done, but by that time the JavaScript code has already decided that
the watched objects don't exist in the DBus service.

The race is fixed here by only recording the existence of the
ObjectManager when its information has been fully retrieved.  For the
scenario described above, this means that the poke batch will run to
completion as if no ObjectManager would exist.  (This means some double
work, but only very rarely.)

However, we only want to react to the discovery of a ObjectManager
once, so we also record it separately immediately upion discovery in
"self->managed_not_ready".  This is only used to avoid duplicate
discoveries, not for deciding whether to skip some introspection
tasks.

garrett/cockpit,cockpit-project/cockpit,martinpitt/cockpit,cockpit-project/cockpit,cockpit-project/cockpit,cockpit-project/cockpit,garrett/cockpit,cockpit-project/cockpit,martinpitt/cockpit,garrett/cockpit,mvollmer/cockpit,martinpitt/cockpit,garrett/cockpit,mvollmer/cockpit,mvollmer/cockpit,martinpitt/cockpit,garrett/cockpit,mvollmer/cockpit,martinpitt/cockpit,mvollmer/cockpit