From 4d789940d828bc8a07a56eb4f374b8943b358c7e Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 19 Mar 2014 19:04:26 +0200 Subject: [PATCH] gattrib: Fix pending command handling when getting disconnected --- attrib/gattrib.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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; } -- 2.47.3