Server Keepalive: Timeout sessions observing Unknown or Proxy resources

In general, the Unknown or Proxy resources should not be set as observable.
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2025-02-17 09:32:14 +00:00
1 parent 18274073da
commit a51fa3b77d
1 file changed
+16 -2
+16 -2
View File
@@ -604,18 +604,32 @@ coap_session_free(coap_session_t *session) {
#if COAP_SERVER_SUPPORT
void
coap_session_server_keepalive_failed(coap_session_t *session) {
int i;
coap_session_reference_lkd(session);
coap_handle_event_lkd(session->context, COAP_EVENT_KEEPALIVE_FAILURE, session);
coap_cancel_all_messages(session->context, session, NULL);
RESOURCES_ITER(session->context->resources, r) {
int i;
/* In case code is broken somewhere */
for (i = 0; i < 1000; i++) {
if (!coap_delete_observer(r, session, NULL))
break;
}
}
if (session->context->unknown_resource) {
/* In case code is broken somewhere */
for (i = 0; i < 1000; i++) {
if (!coap_delete_observer(session->context->unknown_resource, session, NULL))
break;
}
}
if (session->context->proxy_uri_resource) {
/* In case code is broken somewhere */
for (i = 0; i < 1000; i++) {
if (!coap_delete_observer(session->context->proxy_uri_resource, session, NULL))
break;
}
}
while (session->delayqueue) {
coap_queue_t *q = session->delayqueue;