From a6cabbf64b67c0220c854d5bd17fff8ff8184895 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 7 Nov 2011 11:09:18 -0300 Subject: [PATCH] Remove CCC if the device is not bonded Changes attrib server to remove CCC entries of the device when the connection is established if the device is not bonded. --- src/attrib-server.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/attrib-server.c b/src/attrib-server.c index b84b01dfc..b767b72a0 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -38,10 +38,14 @@ #include #include "log.h" +#include "gdbus.h" #include "glib-compat.h" #include "btio.h" #include "sdpd.h" #include "hcid.h" +#include "adapter.h" +#include "device.h" +#include "manager.h" #include "att.h" #include "gattrib.h" #include "storage.h" @@ -834,9 +838,12 @@ done: guint attrib_channel_attach(GAttrib *attrib, gboolean out) { + struct btd_adapter *adapter; + struct btd_device *device; struct gatt_channel *channel; GIOChannel *io; GError *gerr = NULL; + char addr[18]; uint16_t cid; io = g_attrib_get_channel(attrib); @@ -856,6 +863,14 @@ guint attrib_channel_attach(GAttrib *attrib, gboolean out) return 0; } + adapter = manager_find_adapter(&channel->src); + + ba2str(&channel->dst, addr); + device = adapter_find_device(adapter, addr); + + if (device_is_bonded(device) == FALSE) + delete_device_ccc(&channel->src, &channel->dst); + if (channel->mtu > ATT_MAX_MTU) channel->mtu = ATT_MAX_MTU;