From eb41b504d014f30aae18a1505fafe024a127f603 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Mon, 19 Sep 2011 10:20:00 -0300 Subject: [PATCH] Fix the attrib server trying to handle responses The attribute server should only try to handle ATT requests, responses and events should be handled by the client. --- attrib/gattrib.c | 4 +++- attrib/gattrib.h | 1 + src/attrib-server.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/attrib/gattrib.c b/attrib/gattrib.c index 8c15e52af..4d901f1e2 100644 --- a/attrib/gattrib.c +++ b/attrib/gattrib.c @@ -346,7 +346,9 @@ static gboolean received_data(GIOChannel *io, GIOCondition cond, gpointer data) struct event *evt = l->data; if (evt->expected == buf[0] || - evt->expected == GATTRIB_ALL_EVENTS) + evt->expected == GATTRIB_ALL_EVENTS || + (is_response(buf[0]) == FALSE && + evt->expected == GATTRIB_ALL_REQS)) evt->func(buf, len, evt->user_data); } diff --git a/attrib/gattrib.h b/attrib/gattrib.h index 4c49879b3..47c0d6014 100644 --- a/attrib/gattrib.h +++ b/attrib/gattrib.h @@ -29,6 +29,7 @@ extern "C" { #endif #define GATTRIB_ALL_EVENTS 0xFF +#define GATTRIB_ALL_REQS 0xFE struct _GAttrib; typedef struct _GAttrib GAttrib; diff --git a/src/attrib-server.c b/src/attrib-server.c index 260e64aa8..5c46e6d13 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -954,7 +954,7 @@ int attrib_channel_attach(GAttrib *attrib, gboolean out) channel->attrib = g_attrib_ref(attrib); - channel->id = g_attrib_register(channel->attrib, GATTRIB_ALL_EVENTS, + channel->id = g_attrib_register(channel->attrib, GATTRIB_ALL_REQS, channel_handler, channel, NULL); if (out == FALSE) -- 2.47.3