summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gsupplicant/gsupplicant.h1
-rw-r--r--gsupplicant/supplicant.c16
2 files changed, 17 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 78e1a0b..9c33ed8 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -335,6 +335,7 @@ bool g_supplicant_peer_is_wps_pin(GSupplicantPeer *peer);
bool g_supplicant_peer_is_in_a_group(GSupplicantPeer *peer);
GSupplicantInterface *g_supplicant_peer_get_group_interface(GSupplicantPeer *peer);
bool g_supplicant_peer_is_client(GSupplicantPeer *peer);
+bool g_supplicant_peer_has_requested_connection(GSupplicantPeer *peer);
struct _GSupplicantCallbacks {
void (*system_ready) (void);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index eb25c49..176d705 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -236,6 +236,7 @@ struct _GSupplicantPeer {
unsigned int wps_capabilities;
GSList *groups;
const GSupplicantInterface *current_group_iface;
+ bool connection_requested;
};
struct _GSupplicantGroup {
@@ -516,6 +517,8 @@ static void callback_peer_request(GSupplicantPeer *peer)
if (!callbacks_pointer->peer_request)
return;
+ peer->connection_requested = true;
+
callbacks_pointer->peer_request(peer);
}
@@ -1158,6 +1161,14 @@ bool g_supplicant_peer_is_client(GSupplicantPeer *peer)
return false;
}
+bool g_supplicant_peer_has_requested_connection(GSupplicantPeer *peer)
+{
+ if (!peer)
+ return false;
+
+ return peer->connection_requested;
+}
+
static void merge_network(GSupplicantNetwork *network)
{
GString *str;
@@ -2782,6 +2793,9 @@ static void signal_peer_changed(const char *path, DBusMessageIter *iter)
callback_peer_changed(peer, G_SUPPLICANT_PEER_GROUP_CHANGED);
dbus_free(property_data);
+
+ if (!g_supplicant_peer_is_in_a_group(peer))
+ peer->connection_requested = false;
}
struct group_sig_data {
@@ -2873,6 +2887,7 @@ static void signal_group_failure(const char *path, DBusMessageIter *iter)
return;
callback_peer_changed(peer, G_SUPPLICANT_PEER_GROUP_FAILED);
+ peer->connection_requested = false;
}
static void signal_group_started(const char *path, DBusMessageIter *iter)
@@ -3066,6 +3081,7 @@ static void signal_group_peer_disconnected(const char *path, DBusMessageIter *it
return;
callback_peer_changed(peer, G_SUPPLICANT_PEER_GROUP_DISCONNECTED);
+ peer->connection_requested = false;
}
static struct {