Diff between 2abb3498e8e6296c2564b410e226450a3419c54e and a6cabbf64b67c0220c854d5bd17fff8ff8184895

Changed Files

File Additions Deletions Status
src/attrib-server.c +15 -0 modified

Full Patch

diff --git a/src/attrib-server.c b/src/attrib-server.c
index b84b01d..b767b72 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -38,10 +38,14 @@
 #include <bluetooth/sdp_lib.h>
 
 #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;