* [PATCH BlueZ v1] mainloop: Only connect to NOTIFY_SOCKET if STATUS=Starting up
@ 2025-05-02 16:12 Luiz Augusto von Dentz
2025-05-02 17:56 ` [BlueZ,v1] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2025-05-02 16:12 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes the handling of NOYIFY_SOCKET conditional to only when
application attempts to set STATUS=Starting up which means it is
intentionally requiring it.
Fixes: https://github.com/bluez/bluez/issues/996
---
src/shared/mainloop-glib.c | 1 -
src/shared/mainloop-notify.c | 11 +++++++++--
src/shared/mainloop.c | 2 --
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/shared/mainloop-glib.c b/src/shared/mainloop-glib.c
index 7d4b057bf6ec..042119baf1ad 100644
--- a/src/shared/mainloop-glib.c
+++ b/src/shared/mainloop-glib.c
@@ -33,7 +33,6 @@ static int exit_status;
void mainloop_init(void)
{
main_loop = g_main_loop_new(NULL, FALSE);
- mainloop_notify_init();
}
void mainloop_quit(void)
diff --git a/src/shared/mainloop-notify.c b/src/shared/mainloop-notify.c
index 11989512e013..5100a4e89285 100644
--- a/src/shared/mainloop-notify.c
+++ b/src/shared/mainloop-notify.c
@@ -111,8 +111,15 @@ int mainloop_sd_notify(const char *state)
{
int err;
- if (notify_fd <= 0)
- return -ENOTCONN;
+ if (notify_fd <= 0) {
+ if (strcmp(state, "STATUS=Starting up"))
+ return -ENOTCONN;
+
+ /* Auto init only when starting up */
+ mainloop_notify_init();
+ if (notify_fd <= 0)
+ return -ENOTCONN;
+ }
err = send(notify_fd, state, strlen(state), MSG_NOSIGNAL);
if (err < 0)
diff --git a/src/shared/mainloop.c b/src/shared/mainloop.c
index b71707cae4fa..9a2e1eee6f97 100644
--- a/src/shared/mainloop.c
+++ b/src/shared/mainloop.c
@@ -65,8 +65,6 @@ void mainloop_init(void)
mainloop_list[i] = NULL;
epoll_terminate = 0;
-
- mainloop_notify_init();
}
void mainloop_quit(void)
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-02 17:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 16:12 [PATCH BlueZ v1] mainloop: Only connect to NOTIFY_SOCKET if STATUS=Starting up Luiz Augusto von Dentz
2025-05-02 17:56 ` [BlueZ,v1] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox