pulse-server: add event to the implementation

Add events when a server is started and stopped
This commit is contained in:
Wim Taymans 2022-11-17 18:31:23 +01:00
parent ab5fe8957b
commit a11612bdad
3 changed files with 30 additions and 1 deletions

View file

@ -899,7 +899,7 @@ static struct server *server_new(struct impl *impl)
static int server_start(struct server *server, const struct sockaddr_storage *addr)
{
const struct impl * const impl = server->impl;
struct impl * const impl = server->impl;
int res = 0, fd;
switch (addr->ss_family) {
@ -924,6 +924,8 @@ static int server_start(struct server *server, const struct sockaddr_storage *ad
res = -errno;
pw_log_error("server %p: can't create server source: %m", impl);
}
if (res >= 0)
spa_hook_list_call(&impl->hooks, struct impl_events, server_started, 0, server);
return res;
}
@ -1069,6 +1071,8 @@ void server_free(struct server *server)
client_unref(c);
}
spa_hook_list_call(&impl->hooks, struct impl_events, server_stopped, 0, server);
if (server->source)
pw_loop_destroy_source(impl->loop, server->source);