From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH v2 1/3] station: Use separate msg holder for hidden connections
Date: Tue, 09 Jun 2020 18:22:19 -0700 [thread overview]
Message-ID: <20200610012221.19263-1-tim.a.kourt@linux.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2769 bytes --]
Introduce hidden_pending to keep reference to the dbus message object
while we wait for the scan results to be returned while trying to
connect to a hidden network. This simplifies the logic by separating it
into two independent logical units: scanning, connecting and eliminates
a possibility of a memory leak in the case when Network.Connect being
initiated while Station.ConnectHiddenNetwork is in progress.
---
src/station.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/station.c b/src/station.c
index ca6a0b8e..583016ab 100644
--- a/src/station.c
+++ b/src/station.c
@@ -73,6 +73,7 @@ struct station {
struct l_hashmap *networks;
struct l_queue *networks_sorted;
struct l_dbus_message *connect_pending;
+ struct l_dbus_message *hidden_pending;
struct l_dbus_message *disconnect_pending;
struct l_dbus_message *scan_pending;
struct signal_agent *signal_agent;
@@ -2433,8 +2434,8 @@ static void station_hidden_network_scan_triggered(int err, void *user_data)
if (!err)
return;
- dbus_pending_reply(&station->connect_pending,
- dbus_error_failed(station->connect_pending));
+ dbus_pending_reply(&station->hidden_pending,
+ dbus_error_failed(station->hidden_pending));
}
static bool station_hidden_network_scan_results(int err,
@@ -2452,8 +2453,8 @@ static bool station_hidden_network_scan_results(int err,
l_debug("");
- msg = station->connect_pending;
- station->connect_pending = NULL;
+ msg = station->hidden_pending;
+ station->hidden_pending = NULL;
if (err) {
dbus_pending_reply(&msg, dbus_error_failed(msg));
@@ -2527,7 +2528,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network(
l_debug("");
- if (station->connect_pending || station_is_busy(station))
+ if (station->hidden_pending || station_is_busy(station))
return dbus_error_busy(message);
if (!l_dbus_message_get_arguments(message, "s", &ssid))
@@ -2553,7 +2554,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network(
if (!station->hidden_network_scan_id)
return dbus_error_failed(message);
- station->connect_pending = l_dbus_message_ref(message);
+ station->hidden_pending = l_dbus_message_ref(message);
return NULL;
}
@@ -3132,6 +3133,10 @@ static void station_free(struct station *station)
dbus_pending_reply(&station->connect_pending,
dbus_error_aborted(station->connect_pending));
+ if (station->hidden_pending)
+ dbus_pending_reply(&station->hidden_pending,
+ dbus_error_aborted(station->hidden_pending));
+
if (station->disconnect_pending)
dbus_pending_reply(&station->disconnect_pending,
dbus_error_aborted(station->disconnect_pending));
--
2.13.6
next reply other threads:[~2020-06-10 1:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 1:22 Tim Kourt [this message]
2020-06-10 1:22 ` [PATCH v2 2/3] auto-t: Add async API call for connect_hidden_network Tim Kourt
2020-06-10 1:22 ` [PATCH v2 3/3] auto-t: Validate Connect after ConnectHiddenNetwork Tim Kourt
2020-06-10 2:59 ` [PATCH v2 1/3] station: Use separate msg holder for hidden connections 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=20200610012221.19263-1-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