Diff between 59ba9844eb6bcc4d2c35852e730c0a63d58a83ca and fb23d0273c55d4fa382c8d1e758cca0b75da12e4

Changed Files

File Additions Deletions Status
src/attrib-server.c +6 -3 modified
src/attrib-server.h +1 -1 modified

Full Patch

diff --git a/src/attrib-server.c b/src/attrib-server.c
index e705310..597a635 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -741,7 +741,7 @@ static uint16_t write_value(struct gatt_channel *channel, uint16_t handle,
 	if (client_attr)
 		a = client_attr;
 	else
-		attrib_db_update(a->handle, NULL, value, vlen);
+		attrib_db_update(a->handle, NULL, value, vlen, &a);
 
 	if (a->write_cb) {
 		status = a->write_cb(a, a->cb_user_data);
@@ -1232,7 +1232,7 @@ struct attribute *attrib_db_add(uint16_t handle, bt_uuid_t *uuid, int read_reqs,
 }
 
 int attrib_db_update(uint16_t handle, bt_uuid_t *uuid, const uint8_t *value,
-								int len)
+					int len, struct attribute **attr)
 {
 	struct attribute *a;
 	GSList *l;
@@ -1256,6 +1256,9 @@ int attrib_db_update(uint16_t handle, bt_uuid_t *uuid, const uint8_t *value,
 
 	attrib_notify_clients(a);
 
+	if (attr)
+		*attr = a;
+
 	return 0;
 }
 
@@ -1295,5 +1298,5 @@ int attrib_gap_set(uint16_t uuid, const uint8_t *value, int len)
 		return -ENOSYS;
 	}
 
-	return attrib_db_update(handle, NULL, value, len);
+	return attrib_db_update(handle, NULL, value, len, NULL);
 }
diff --git a/src/attrib-server.h b/src/attrib-server.h
index c03d3c5..38a1f05 100644
--- a/src/attrib-server.h
+++ b/src/attrib-server.h
@@ -28,7 +28,7 @@ void attrib_server_exit(void);
 struct attribute *attrib_db_add(uint16_t handle, bt_uuid_t *uuid, int read_reqs,
 				int write_reqs, const uint8_t *value, int len);
 int attrib_db_update(uint16_t handle, bt_uuid_t *uuid, const uint8_t *value,
-								int len);
+					int len, struct attribute **attr);
 int attrib_db_del(uint16_t handle);
 int attrib_gap_set(uint16_t uuid, const uint8_t *value, int len);
 uint32_t attrib_create_sdp(uint16_t handle, const char *name);