diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2014-01-28 11:51:38 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-03-05 22:39:01 +0200 |
commit | 7b19bbd8a0d1eaac1e3ec58af3637ecd7b427fd8 (patch) | |
tree | a13206ad386923567a1ca516e805684e5ccd6252 /profiles/alert | |
parent | ef77cc7a527b3703783617d0afc75a5aad135771 (diff) | |
download | bluez-7b19bbd8a0d1eaac1e3ec58af3637ecd7b427fd8.tar.gz |
alert: Only remove attio callback after ATT request was sent
If there is a single registered attio callback, any pending ATT requests
will be dropped as soon as it is removed. This commit makes sure that
the request is sent before removing the callback.
Other places using attio callbacks may need fixing as well.
Diffstat (limited to 'profiles/alert')
-rw-r--r-- | profiles/alert/server.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/profiles/alert/server.c b/profiles/alert/server.c index 94e986523..92d4fb69d 100644 --- a/profiles/alert/server.c +++ b/profiles/alert/server.c @@ -363,6 +363,20 @@ end: return result; } +static void destroy_notify_callback(guint8 status, const guint8 *pdu, guint16 len, + gpointer user_data) +{ + struct notify_callback *cb = user_data; + + DBG("status=%#x", status); + + btd_device_remove_attio_callback(cb->device, cb->id); + btd_device_unref(cb->device); + g_free(cb->notify_data->value); + g_free(cb->notify_data); + g_free(cb); +} + static void attio_connected_cb(GAttrib *attrib, gpointer user_data) { struct notify_callback *cb = user_data; @@ -398,7 +412,9 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data) al_adapter->hnd_value[type], al_adapter->hnd_ccc[type]); - g_attrib_send(attrib, 0, pdu, len, NULL, NULL, NULL); + g_attrib_send(attrib, 0, pdu, len, destroy_notify_callback, cb, NULL); + + return; end: btd_device_remove_attio_callback(cb->device, cb->id); |