From 7af43d87b33962c66b4bd1fa44056812490474d6 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 22 Oct 2024 09:32:08 +0200 Subject: [PATCH] protocol-native: write socket address after adding Only write the socket address after we managed to add the fd to the main loop. Only log a warning when this fails. --- src/modules/module-protocol-native.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index 66b93fdac..086137b95 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -959,12 +959,6 @@ static int add_socket(struct pw_protocol *protocol, struct server *s, struct soc s, info->name); } - res = write_socket_address(s); - if (res < 0) { - pw_log_error("server %p: failed to write socket address: %s", s, - spa_strerror(res)); - goto error_close; - } s->activated = activated; s->loop = pw_context_get_main_loop(protocol->context); if (s->loop == NULL) { @@ -976,6 +970,11 @@ static int add_socket(struct pw_protocol *protocol, struct server *s, struct soc res = -errno; goto error_close; } + res = write_socket_address(s); + if (res < 0) { + pw_log_warn("server %p: failed to write socket address: %s", s, + spa_strerror(res)); + } return 0; error_close: