* [PATCH 1/2] client: Reorder interface creation ops
@ 2020-02-26 23:32 Tim Kourt
2020-02-26 23:32 ` [PATCH 2/2] client: Rework agent registarion logic Tim Kourt
2020-02-27 22:31 ` [PATCH 1/2] client: Reorder interface creation ops Denis Kenzior
0 siblings, 2 replies; 3+ messages in thread
From: Tim Kourt @ 2020-02-26 23:32 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
Add the newly created proxy objects into the queue before the
interface specific initialization logic takes place. This way the new
proxy objects can be used within the initialization procedures.
---
client/dbus-proxy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 83f91eea..37a09512 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -572,10 +572,10 @@ static void proxy_interface_create(const char *path,
proxy->path = l_strdup(path);
proxy->type = interface_type;
+ l_queue_push_tail(proxy_interfaces, proxy);
+
if (interface_type->ops && interface_type->ops->create)
proxy->data = interface_type->ops->create();
-
- l_queue_push_tail(proxy_interfaces, proxy);
}
}
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] client: Rework agent registarion logic
2020-02-26 23:32 [PATCH 1/2] client: Reorder interface creation ops Tim Kourt
@ 2020-02-26 23:32 ` Tim Kourt
2020-02-27 22:31 ` [PATCH 1/2] client: Reorder interface creation ops Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Tim Kourt @ 2020-02-26 23:32 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 4236 bytes --]
Do agent registration as part of agent manager proxy creation.
This ensures that the registration call is made only after the agent
manager’s interface becomes available on the bus.
---
client/agent-manager.c | 29 +++++++++++++++++++----------
client/agent-manager.h | 3 +--
client/dbus-proxy.c | 13 ++-----------
3 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/client/agent-manager.c b/client/agent-manager.c
index 0bec85e7..68d87cb0 100644
--- a/client/agent-manager.c
+++ b/client/agent-manager.c
@@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
- * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,6 +30,7 @@
#include "client/agent.h"
#include "client/dbus-proxy.h"
#include "client/agent-manager.h"
+#include "client/command.h"
#define IWD_AGENT_MANAGER_PATH "/net/connman/iwd"
@@ -39,18 +40,16 @@ static void check_errors_method_callback(struct l_dbus_message *message,
dbus_message_has_error(message);
}
-bool agent_manager_register_agent(void)
+static bool agent_manager_register_agent(const char *path)
{
- const char *path;
- const struct proxy_interface *proxy =
- proxy_interface_find(IWD_AGENT_MANAGER_INTERFACE,
- IWD_AGENT_MANAGER_PATH);
+ const struct proxy_interface *proxy;
- if (!proxy)
+ if (!path)
return false;
- path = proxy_interface_get_data(proxy);
- if (!path)
+ proxy = proxy_interface_find(IWD_AGENT_MANAGER_INTERFACE,
+ IWD_AGENT_MANAGER_PATH);
+ if (!proxy)
return false;
proxy_interface_method_call(proxy, "RegisterAgent", "o",
@@ -81,10 +80,17 @@ bool agent_manager_unregister_agent(void)
static void *agent_manager_create(void)
{
- char *path = l_strdup_printf("/agent/%i", getpid());
+ char *path;
+
+ if (command_needs_no_agent())
+ return NULL;
+
+ path = l_strdup_printf("/agent/%i", getpid());
agent_init(path);
+ agent_manager_register_agent(path);
+
return path;
}
@@ -92,6 +98,9 @@ static void agent_manager_destroy(void *data)
{
char *path = data;
+ if (!path)
+ return;
+
agent_exit(path);
l_free(path);
diff --git a/client/agent-manager.h b/client/agent-manager.h
index c0433f53..4655100d 100644
--- a/client/agent-manager.h
+++ b/client/agent-manager.h
@@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
- * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,5 +20,4 @@
*
*/
-bool agent_manager_register_agent(void);
bool agent_manager_unregister_agent(void);
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 37a09512..ab9fb5a5 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
- * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -745,14 +745,6 @@ static void get_managed_objects_callback(struct l_dbus_message *message,
while (l_dbus_message_iter_next_entry(&objects, &path, &object))
proxy_interfaces_update_properties(path, &object);
- if (!command_needs_no_agent()) {
- if (!agent_manager_register_agent()) {
- display_error("Failed to register Agent.\n");
-
- goto error;
- }
- }
-
if (command_is_interactive_mode())
display_enable_cmd_prompt();
else
@@ -878,8 +870,7 @@ bool dbus_proxy_exit(void)
{
struct interface_type_desc *desc;
- if (!command_needs_no_agent())
- agent_manager_unregister_agent();
+ agent_manager_unregister_agent();
for (desc = __start___interface; desc < __stop___interface; desc++) {
if (!desc->exit)
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] client: Reorder interface creation ops
2020-02-26 23:32 [PATCH 1/2] client: Reorder interface creation ops Tim Kourt
2020-02-26 23:32 ` [PATCH 2/2] client: Rework agent registarion logic Tim Kourt
@ 2020-02-27 22:31 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2020-02-27 22:31 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 393 bytes --]
Hi Tim,
On 2/26/20 5:32 PM, Tim Kourt wrote:
> Add the newly created proxy objects into the queue before the
> interface specific initialization logic takes place. This way the new
> proxy objects can be used within the initialization procedures.
> ---
> client/dbus-proxy.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Both applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-27 22:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-26 23:32 [PATCH 1/2] client: Reorder interface creation ops Tim Kourt
2020-02-26 23:32 ` [PATCH 2/2] client: Rework agent registarion logic Tim Kourt
2020-02-27 22:31 ` [PATCH 1/2] client: Reorder interface creation ops Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox