From 8f953dfddec52dac7ec53a14e46c3d65cb238c46 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 9 Oct 2020 16:44:55 +0200 Subject: [PATCH] pulse-server: connect in the set_client_name connect after we get the client_name call so that we have all the client properties. --- .../module-protocol-pulse/pulse-server.c | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index d52a828d5..487b3b8c2 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -438,8 +438,16 @@ static int do_set_client_name(struct client *client, uint32_t command, uint32_t return res; changed++; } - if (changed) + if (client->core == NULL) { + client->core = pw_context_connect(impl->context, + pw_properties_copy(client->props), 0); + if (client->core == NULL) { + res = -errno; + goto error; + } + } else { pw_core_update_properties(client->core, &client->props->dict); + } pw_log_info(NAME" %p: SET_CLIENT_NAME %s", impl, pw_properties_get(client->props, "application.name")); @@ -452,6 +460,10 @@ static int do_set_client_name(struct client *client, uint32_t command, uint32_t TAG_INVALID); } return send_message(client, reply); +error: + pw_log_error(NAME" %p: failed to connect client: %m", impl); + return res; + } static int do_subscribe(struct client *client, uint32_t command, uint32_t tag, struct message *m) @@ -2538,10 +2550,6 @@ static int do_read(struct client *client) res = -EPROTO; goto exit; } - } else { - - - } if (client->message) message_free(client, client->message, false); @@ -2600,6 +2608,7 @@ error: else pw_log_error(NAME" %p: client %p error %d (%s)", impl, client, res, spa_strerror(res)); + reply_error(client, -1, ERR_PROTOCOL); client_free(client); } @@ -2644,11 +2653,6 @@ on_connect(void *data, int fd, uint32_t mask) if (client->source == NULL) goto error; - client->core = pw_context_connect(impl->context, - pw_properties_copy(client->props), 0); - if (client->core == NULL) - goto error; - return; error: pw_log_error(NAME" %p: failed to create client: %m", impl);