This let's the incoming connection being handled through the agent. If
no agent is present, nothing will happen and the incoming connection
request will be ignored.
---
include/peer.h | 1 +
src/peer.c | 11 ++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/peer.h b/include/peer.h
index dd118cd..2463066 100644
--- a/include/peer.h
+++ b/include/peer.h
@@ -67,6 +67,7 @@ void connman_peer_set_sub_device(struct connman_peer *peer,
void connman_peer_set_as_master(struct connman_peer *peer, bool master);
int connman_peer_set_state(struct connman_peer *peer,
enum connman_peer_state new_state);
+int connman_peer_request_connection(struct connman_peer *peer);
int connman_peer_register(struct connman_peer *peer);
void connman_peer_unregister(struct connman_peer *peer);
diff --git a/src/peer.c b/src/peer.c
index 866a9ac..7e733d3 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -493,7 +493,9 @@ static void request_authorization_cb(struct connman_peer
*peer,
if (error) {
if (g_strcmp0(error,
- "net.connman.Agent.Error.Canceled") == 0) {
+ "net.connman.Agent.Error.Canceled") == 0 ||
+ g_strcmp0(error,
+ "net.connman.Agent.Error.Rejected") == 0) {
err = -EINVAL;
goto out;
}
@@ -828,6 +830,13 @@ int connman_peer_set_state(struct connman_peer *peer,
return 0;
}
+int connman_peer_request_connection(struct connman_peer *peer)
+{
+ return __connman_agent_request_peer_authorization(peer,
+ request_authorization_cb, false,
+ NULL, NULL);
+}
+
static void peer_up(struct connman_ipconfig *ipconfig, const char *ifname)
{
DBG("%s up", ifname);
--
1.8.5.5
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman