summaryrefslogtreecommitdiff
path: root/android/gatt.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2015-02-10 21:26:20 +0100
committerSzymon Janc <szymon.janc@tieto.com>2015-02-11 11:02:29 +0100
commitb7b73fcfa6ef1787acbe753b1402aa2d795d1725 (patch)
tree6e11de72c1ff799e90a157107728287ca204d422 /android/gatt.c
parente5e9af0cca9cf5d5521f186f5726f75ae84433f7 (diff)
downloadbluez-b7b73fcfa6ef1787acbe753b1402aa2d795d1725.tar.gz
android/gatt: Fix not sending MTU exchange response
g_attrib_set_mtu can invalidate buffer obtained from g_attrib_get_buffer so it must not be called after g_attrib_get_buffer and before g_attrib_send.
Diffstat (limited to 'android/gatt.c')
-rw-r--r--android/gatt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/android/gatt.c b/android/gatt.c
index 1a6de64f9..13f4dfa53 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -6169,6 +6169,9 @@ static uint8_t mtu_att_handle(const uint8_t *cmd, uint16_t cmd_len,
if (!get_local_mtu(dev, &mtu))
return ATT_ECODE_UNLIKELY;
+ if (!update_mtu(dev, rmtu))
+ return ATT_ECODE_UNLIKELY;
+
rsp = g_attrib_get_buffer(dev->attrib, &length);
/* Respond with our MTU */
@@ -6176,9 +6179,6 @@ static uint8_t mtu_att_handle(const uint8_t *cmd, uint16_t cmd_len,
if (!len)
return ATT_ECODE_UNLIKELY;
- if (!update_mtu(dev, rmtu))
- return ATT_ECODE_UNLIKELY;
-
g_attrib_send(dev->attrib, 0, rsp, len, NULL, NULL, NULL);
return 0;