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.
This commit is contained in:
Barnabás Pőcze 2022-01-31 01:53:27 +01:00 committed by Wim Taymans
parent f5e561c2fe
commit 4426da6a62
3 changed files with 2 additions and 5 deletions

View file

@ -167,10 +167,8 @@ void client_free(struct client *client)
spa_list_consume(o, &client->operations, link)
operation_free(o);
if (client->core) {
client->disconnecting = true;
if (client->core)
pw_core_disconnect(client->core);
}
pw_map_clear(&client->streams);

View file

@ -95,7 +95,6 @@ struct client {
struct spa_list pending_streams;
unsigned int disconnect:1;
unsigned int disconnecting:1;
unsigned int new_msg_since_last_flush:1;
unsigned int authenticated:1;

View file

@ -994,7 +994,7 @@ static void stream_state_changed(void *data, enum pw_stream_state old,
case PW_STREAM_STATE_UNCONNECTED:
if (stream->create_tag != SPA_ID_INVALID)
reply_error(client, -1, stream->create_tag, -ENOENT);
else if (!client->disconnecting)
else
stream->killed = true;
stream->done = true;
break;