From 85ea3eebc70469d6183761e54dfc0e688b8a9e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag=20Bj=C3=B6rklund?= Date: Wed, 18 Dec 2013 09:31:07 +0200 Subject: [PATCH] Only requiring an observervable resource to have a GET handler, if it is in fact an observable resource Signed-off-by: Olaf Bergmann --- resource.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resource.c b/resource.c index 36d20e8a..2106db78 100644 --- a/resource.c +++ b/resource.c @@ -632,13 +632,14 @@ coap_notify_observers(coap_context_t *context, coap_resource_t *r) { str token; coap_pdu_t *response; - /* retrieve GET handler, prepare response */ - h = r->handler[COAP_REQUEST_GET - 1]; - assert(h); /* we do not allow subscriptions if no - * GET handler is defined */ - if (r->observable && (r->dirty || r->partiallydirty)) { r->partiallydirty = 0; + + /* retrieve GET handler, prepare response */ + h = r->handler[COAP_REQUEST_GET - 1]; + assert(h); /* we do not allow subscriptions if no + * GET handler is defined */ + for (obs = list_head(r->subscribers); obs; obs = list_item_next(obs)) { if (r->dirty == 0 && obs->dirty == 0) /* running this resource due to partiallydirty, but this observation's notification was already enqueued */