resource.c: Further fix making subscribers iteration safe

This commit is contained in:
Jon Shallow authored and obgm committed 2022-06-27 13:19:18 +02:00
1 parent f93b9a3e37
commit e8052b3988
1 file changed
+8 -2
+8 -2
View File
@@ -1032,14 +1032,20 @@ coap_notify_observers(coap_context_t *context, coap_resource_t *r,
mid = coap_send_internal( obs->session, response );
if (COAP_INVALID_MID == mid) {
coap_subscription_t *s;
coap_log(LOG_DEBUG,
"coap_check_notify: sending failed, resource stays "
"partially dirty\n");
obs->dirty = 1;
LL_FOREACH(r->subscribers, s) {
if (s == obs) {
/* obs not deleted during coap_send_internal() */
obs->dirty = 1;
break;
}
}
r->partiallydirty = 1;
context->observe_pending = 1;
}
}
}
r->dirty = 0;