From 460c7248bb507c18ca75dec1c4d1e2e636ebd389 Mon Sep 17 00:00:00 2001 From: jcmichelou Date: Tue, 8 May 2018 20:23:48 +0200 Subject: [PATCH] resource.c: Return 0 if there is no observer to notify. According to documentation, coap_resource_notify_observers() must return 0 if no observer will be notified. This can help an application release resources associated to that resource for observation. --- src/resource.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/resource.c b/src/resource.c index 59add5ac..b695398a 100644 --- a/src/resource.c +++ b/src/resource.c @@ -827,6 +827,8 @@ coap_resource_notify_observers(coap_resource_t *r, const coap_string_t *query) { if (!found) return 0; } else { + if ( !r->subscribers ) + return 0; r->dirty = 1; }