summaryrefslogtreecommitdiff
path: root/attrib
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-03-19 19:04:26 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2014-03-19 19:28:50 +0200
commit4d789940d828bc8a07a56eb4f374b8943b358c7e (patch)
tree72a0cecbf822195bf7fc73ca22d22822ac04374a /attrib
parent91441909dcbd5a7c78615ccc621064d25334c9e0 (diff)
downloadbluez-4d789940d828bc8a07a56eb4f374b8943b358c7e.tar.gz
gattrib: Fix pending command handling when getting disconnected
Diffstat (limited to 'attrib')
-rw-r--r--attrib/gattrib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index daf631207..31450a3bd 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -402,7 +402,16 @@ static gboolean received_data(GIOChannel *io, GIOCondition cond, gpointer data)
return FALSE;
if (cond & (G_IO_HUP | G_IO_ERR | G_IO_NVAL)) {
+ struct command *c;
+
+ while ((c = g_queue_pop_head(attrib->requests))) {
+ if (c->func)
+ c->func(ATT_ECODE_IO, NULL, 0, c->user_data);
+ command_destroy(c);
+ }
+
attrib->read_watch = 0;
+
return FALSE;
}