Commit graph

20 commits

Author SHA1 Message Date
Wim Taymans
15e4e6bcbc pulse-server: remove warning
When we get EPIPE from a client send, pass the error code without
logging a warning. The caller will log an appropriate message instead.

Fixes #2754
2022-10-12 10:17:49 +02:00
Pauli Virtanen
a46d4aedd7 pulse-server: work around race condition in SET_DEFAULT/MOVE_*
The default metadata update may be delayed for some time after
SET_DEFAULT, since the session manager has to work on it.

MOVE_* commands need to know what the client thinks is the current
default sink, so that they can decide between "move to default" and
"move to specific device".

To avoid race condition here, stash the default value set by the client
and use it in the MOVE_* commands, until the metadata update arrives.
2022-07-04 15:57:31 +00:00
Barnabás Pőcze
080a97c0bb pulse-server: message: store pointer to impl directly
Store a pointer to the owner `impl` object instead of
the (embedded) `stat` object. This way `message_free()`
can be simplified since the owner `impl` does not need
to be passed explicitly.
2022-06-16 18:38:30 +00:00
Barnabás Pőcze
514f138ec3 pulse-server: client: drop unused argument 2022-02-06 00:49:12 +01:00
Barnabás Pőcze
4426da6a62 pulse-server: client: remove disconnecting flag
When the `disconnecting` flag was first added in
d44fdabea1, a client's
streams were not explicitly destroyed when it was freed,
instead, only the client's pw_core was disconnected,
which then caused all related streams to be destroyed.

Thus there needed to be a way to determine why the stream's
state changed to PW_STREAM_STATE_UNCONNECTED as it may have
been because the client is disconnecting or because the
stream has been "killed" in some other way.

The `COMMAND_{PLAYBACK,RECORD}_STREAM_KILLED` command
only needed to be sent to the client in the second case.

However, at the moment, all streams of a client are explicitly
destroyed before it's pw_core is disconnected. This makes the
`disconnecting` flag unnecessary, thus it can be removed.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
6d0075b4e9 pulse-server: client: cancel related work queue jobs 2022-02-02 15:40:43 +00:00
Barnabás Pőcze
78aaa0a3dd pulse-server: client: move to cleanup list on detach
Move a client to the `impl->cleanup_clients` list right
after it has been removed its server's `clients` list.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
d2edb1ab16 pulse-server: client: do not leave dangling pointers behind 2022-02-02 15:40:43 +00:00
Wim Taymans
0904a35ba8 pulse-server: make separate index
Separate the id (the pipewire object id) from the index (what we send to
the client to identify the objects).
2022-01-17 12:01:13 +01:00
Barnabás Pőcze
3d081215f2 pulse-server: improve message queue pruning
Firstly, separate the message dropping logic into
its own `drop_from_out_queue()` function.

Secondly, do not check earlier messages if the NEW
event for a particular object has been reached while
processing a REMOVE event for that object.

Thirdly, if - while processing a REMOVE event -
the corresponding NEW event is found and dropped,
drop the REMOVE event as well.

See #1840
2022-01-13 18:14:42 +00:00
Barnabás Pőcze
043934655a pulse-server: client: add 'disconnect' event
Have the clients emit a 'disconnect' event when they are
being disconnected.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
2d4febaba1 pulse-server: client: do not drop partially sent messages
If the first message has already been partially sent, do not
drop it when looking for redundant messages.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
4678ea06a0 pulse-server: client: restructure message handling
Move all I/O event source modifications into client.c.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
5ef9deae83 pulse-server: client: do not queue messages after disconnect
Do not queue messages to be delivered to a client if
that client has already disconnected.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
6d2e6fde75 pulse-server: move parts of client creation
Move some portions of the client creation logic into client.c
so that it is easier to keep it in sync with `client_free()`, etc.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
9c218b2d08 pulse-server: remove unnecessary NULL checks
`free()` and `pw_properties_free()` already include a NULL
check before proceeding.
2021-12-26 19:37:41 +00:00
Wim Taymans
ac4ec20b01 pulse-server: free pending client message
If the client is destroyed before it could completely read the message,
free the pending message as well.

See #1840
2021-11-23 18:13:35 +01:00
Peter Hutterer
52a96bb602 modules: add log topics to module-protocol-pulse
This ends up using a nested namespace: mod.protocol-pulse for the module
itself, mod.protocol-pulse.foo for the various submodules and
extensions.
2021-09-28 09:35:39 +02:00
Barnabás Pőcze
d366487116 pulse-server: split out server creation and socket handling
Part of !776.
2021-06-25 03:23:32 +02:00
Barnabás Pőcze
49d31ea0af pulse-server: split out reply, operation, client, stream
Part of !776.
2021-06-25 03:23:27 +02:00