net: lwm2m: Reset only messages owned by lwm2m context

The context should only clear messages it owns, not all of them. Since
both context (LwM2M and FOTA) share common message pool, they might
interrupt their operation otherwise (i. e. cancel retransmissions).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2020-07-01 14:28:32 +02:00 committed by Anas Nashif
commit 2eb633d12e

View file

@ -4032,9 +4032,10 @@ int lwm2m_engine_context_close(struct lwm2m_ctx *client_ctx)
}
}
for (i = 0, msg = messages; i < CONFIG_LWM2M_ENGINE_MAX_MESSAGES;
i++, msg++) {
memset(msg, 0, sizeof(struct lwm2m_message));
for (i = 0, msg = messages; i < ARRAY_SIZE(messages); i++, msg++) {
if (msg->ctx == client_ctx) {
lwm2m_reset_message(msg, true);
}
}
coap_pendings_clear(client_ctx->pendings,