Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH] p2p: when disabling p2p technology we should
disconnect from peers (Vasyl Vavrychuk)
----------------------------------------------------------------------
Message: 1
Date: Tue, 16 Oct 2018 02:21:04 +0300
From: Vasyl Vavrychuk <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>, Vasyl Vavrychuk
<[email protected]>
Subject: [PATCH] p2p: when disabling p2p technology we should
disconnect from peers
Message-ID: <[email protected]>
Having disabled but connected technology does not make sense.
---
src/connman.h | 1 +
src/peer.c | 12 ++++++++++++
src/technology.c | 1 +
3 files changed, 14 insertions(+)
diff --git a/src/connman.h b/src/connman.h
index 13553833..c4190fd0 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -826,6 +826,7 @@ void __connman_peer_cleanup(void);
void __connman_peer_list_struct(DBusMessageIter *array);
const char *__connman_peer_get_path(struct connman_peer *peer);
+void __connman_peer_disconnect_all(void);
int __connman_peer_service_init(void);
void __connman_peer_service_cleanup(void);
diff --git a/src/peer.c b/src/peer.c
index dbd9cd68..2102f119 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -1180,6 +1180,18 @@ const char *__connman_peer_get_path(struct connman_peer
*peer)
return peer->path;
}
+static void disconnect_peer_hash_table(gpointer key,
+ gpointer value, gpointer user_data)
+{
+ struct connman_peer *peer = value;
+ peer_disconnect(peer);
+}
+
+void __connman_peer_disconnect_all(void)
+{
+ g_hash_table_foreach(peers_table, disconnect_peer_hash_table, NULL);
+}
+
int __connman_peer_init(void)
{
DBG("");
diff --git a/src/technology.c b/src/technology.c
index bd2e06a9..62ab6ab5 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -782,6 +782,7 @@ static int technology_disable(struct connman_technology
*technology)
if (technology->type == CONNMAN_SERVICE_TYPE_P2P) {
technology->enable_persistent = false;
__connman_device_stop_scan(CONNMAN_SERVICE_TYPE_P2P);
+ __connman_peer_disconnect_all();
return technology_disabled(technology);
} else if (technology->type == CONNMAN_SERVICE_TYPE_WIFI) {
struct connman_technology *p2p;
--
2.19.1
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 36, Issue 16
***************************************