From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 5/5] client: Fail in non-interactive mode if iwd service isn’t running
Date: Fri, 08 Nov 2019 11:32:23 -0800 [thread overview]
Message-ID: <20191108193223.1950-5-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20191108193223.1950-1-tim.a.kourt@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2186 bytes --]
In non-interactive mode request the managed object right away and do
not wait for the service to appear. This way client can fail right
away instead of endlessly waiting in non-interactive mode.
---
client/dbus-proxy.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 37f0e75c..313cd5a6 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -740,11 +740,17 @@ static void get_managed_objects_callback(struct l_dbus_message *message,
display_enable_cmd_prompt();
}
-static void service_appeared_callback(struct l_dbus *dbus, void *user_data)
+static void get_managed_objects(void)
{
- if (!command_is_interactive_mode())
- goto get_objects;
+ l_dbus_method_call(dbus, IWD_SERVICE, IWD_ROOT_PATH,
+ L_DBUS_INTERFACE_OBJECT_MANAGER,
+ "GetManagedObjects", NULL,
+ get_managed_objects_callback,
+ NULL, NULL);
+}
+static void service_appeared_callback(struct l_dbus *dbus, void *user_data)
+{
l_dbus_add_signal_watch(dbus, IWD_SERVICE, IWD_ROOT_PATH,
L_DBUS_INTERFACE_OBJECT_MANAGER,
"InterfacesAdded", L_DBUS_MATCH_NONE,
@@ -759,12 +765,8 @@ static void service_appeared_callback(struct l_dbus *dbus, void *user_data)
L_DBUS_INTERFACE_PROPERTIES,
"PropertiesChanged", L_DBUS_MATCH_NONE,
properties_changed_callback, NULL);
-get_objects:
- l_dbus_method_call(dbus, IWD_SERVICE, IWD_ROOT_PATH,
- L_DBUS_INTERFACE_OBJECT_MANAGER,
- "GetManagedObjects", NULL,
- get_managed_objects_callback,
- NULL, NULL);
+
+ get_managed_objects();
}
static void service_disappeared_callback(struct l_dbus *dbus,
@@ -834,9 +836,13 @@ bool dbus_proxy_init(void)
l_dbus_set_disconnect_handler(dbus, dbus_disconnect_callback, NULL,
NULL);
- l_dbus_add_service_watch(dbus, IWD_SERVICE, service_appeared_callback,
+ if (command_is_interactive_mode())
+ l_dbus_add_service_watch(dbus, IWD_SERVICE,
+ service_appeared_callback,
service_disappeared_callback,
NULL, NULL);
+ else
+ get_managed_objects();
return true;
}
--
2.13.6
next prev parent reply other threads:[~2019-11-08 19:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 19:32 [PATCH 1/5] client: Extend client proxy object's API Tim Kourt
2019-11-08 19:32 ` [PATCH 2/5] client: Add start/stop ops to agent manager proxy Tim Kourt
2019-11-09 3:21 ` Denis Kenzior
2019-11-08 19:32 ` [PATCH 3/5] client: Remove explicit agent registartion from framework Tim Kourt
2019-11-08 19:32 ` [PATCH 4/5] client: Use full include path for local includes Tim Kourt
2019-11-08 19:32 ` Tim Kourt [this message]
2019-11-09 3:22 ` [PATCH 5/5] client: Fail in non-interactive mode if iwd service isn’t running Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191108193223.1950-5-tim.a.kourt@linux.intel.com \
--to=tim.a.kourt@linux.intel.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox