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.
This commit is contained in:
Wim Taymans 2024-10-22 09:32:08 +02:00
parent ced57514f4
commit 7af43d87b3

View file

@ -959,12 +959,6 @@ static int add_socket(struct pw_protocol *protocol, struct server *s, struct soc
s, info->name); 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->activated = activated;
s->loop = pw_context_get_main_loop(protocol->context); s->loop = pw_context_get_main_loop(protocol->context);
if (s->loop == NULL) { if (s->loop == NULL) {
@ -976,6 +970,11 @@ static int add_socket(struct pw_protocol *protocol, struct server *s, struct soc
res = -errno; res = -errno;
goto error_close; 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; return 0;
error_close: error_close: