pipewire/src/modules
Pauli Virtanen d44bf0ffc0 impl-core/protocol-native: use generation counter for global registry
Some client messages have bare ids (as opposed to proxies/resources),
eg. as in pw_registry_bind/destroy.  If the client is processing
messages late, these may refer to an object that was already removed,
and the id may now refers to a differnt objects.  I.e. the following
race condition needs to be resolved:

server               client
Global 1 (gen. 1)
                     Global 1
Global 1 remove
Global 1 (gen. 2)
                     Bind/destroy 1

Where the client would bind/destroy the wrong global, since it did not
yet see the messages for the second one.

To keep track of which object the client means, the server keeps track of
the "generation number" of its global registry, and what generation
the client is at.

Each global remembers at what generation of registry they were
registered. When processing the messages that use bare ids, check the
registry generation of the client, to know whether the message refers to
a stale global that was already removed.

Messages where client sends bare ids to server are:

    pw_registry_bind, pw_registry_destroy, metadata_set_property

In pw_registry_* do the staleness check directly. Also add staleness
check in pw_impl_client_check_permissions, so that also the metadata
case is handled.

The generation numbers are passed around in message footers, but only if
they have changed.  When the generation number changes on server, we
send the updated value to the client in a message footer.  When client
has received an update value, it will send the value back in the footer
of the next message it sends to the server.

Based on: Wim Taymans <wtaymans@redhat.com> "impl-core: check serial number"
2022-02-20 16:59:25 +02:00
..
module-adapter adapter: add adapter.auto-port-config property 2022-01-20 18:08:30 +01:00
module-client-device modules: limit the max amount of items in the protocol 2022-01-28 15:55:44 +01:00
module-client-node client-node: remove MAX_MIX limit 2022-02-09 16:12:17 +01:00
module-filter-chain filter-chain: improve lv2 support 2021-12-29 17:17:17 +01:00
module-metadata module-metadata: allow create without client 2022-01-18 12:42:23 +01:00
module-profiler modules: use the new topic-based logging from various pipewire modules 2021-09-28 09:35:39 +02:00
module-protocol-native impl-core/protocol-native: use generation counter for global registry 2022-02-20 16:59:25 +02:00
module-protocol-pulse pipewire-pulse: moving DONT_MOVE streams should fail 2022-02-20 01:30:48 +02:00
module-raop raop: fix errno check 2022-01-12 10:11:00 +01:00
module-session-manager modules: limit the max amount of items in the protocol 2022-01-28 15:55:44 +01:00
module-zeroconf-discover pipewire: module-zeroconf-discover: free correct pointer 2021-06-16 17:39:25 +00:00
spa resource: allow NULL resource in error 2022-02-02 21:33:33 +01:00
meson.build protocol-native: extend v3 protocol with message footers 2022-02-20 16:59:25 +02:00
module-access.c treewide: only define feature macros when the feature is available 2022-02-04 00:15:59 +01:00
module-adapter.c resource: allow NULL resource in error 2022-02-02 21:33:33 +01:00
module-client-device.c modules: check for a NULL resource in client-device and client-node 2021-11-19 09:58:49 +10:00
module-client-node.c modules: check for a NULL resource in client-device and client-node 2021-11-19 09:58:49 +10:00
module-echo-cancel.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-example-sink.c pipewire: remove work queue checks 2022-02-18 12:30:53 +01:00
module-example-source.c pipewire: remove work queue checks 2022-02-18 12:30:53 +01:00
module-fallback-sink.c module-fallback-sink: add dynamically appearing fallback sink 2022-02-13 09:54:55 +00:00
module-filter-chain.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-link-factory.c modules: fix warning 2022-02-18 15:12:27 +01:00
module-loopback.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-metadata.c resource: allow NULL resource in error 2022-02-02 21:33:33 +01:00
module-portal.c modules: switch to new property helpers 2021-10-13 07:12:00 +00:00
module-profiler.c profiler: add force rate and quantum to latency 2022-02-11 12:24:16 +01:00
module-protocol-native.c protocol-native: extend v3 protocol with message footers 2022-02-20 16:59:25 +02:00
module-protocol-pulse.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
module-protocol-simple.c pipewire: remove work queue checks 2022-02-18 12:30:53 +01:00
module-pulse-tunnel.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-raop-discover.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-raop-sink.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-roc-sink.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-roc-source.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00
module-rt.c module-rt: Handle realtime sched check edge cases 2022-01-21 14:17:29 +01:00
module-session-manager.c doc: add the documentation infrastructure for pipewire modules 2021-06-25 08:42:24 +00:00
module-x11-bell.c pipewire: module-x11-bell: mark connection as terminatable 2022-02-18 12:30:53 +01:00
module-zeroconf-discover.c pipewire: use newly added function for deferred module destroy 2022-02-18 12:30:53 +01:00