net: lwm2m: update client tx timestamp before sending message

Update client tx timestamp right after message is added to list
of outgoing messages. Delay between when message is generated and
sent is negligible. This will prevents bugs that appear when using
queue mode, where internal engine logic depends on timestamp being
updated when message is generated.

Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
This commit is contained in:
Marin Jurjević 2022-03-15 15:32:41 +01:00 committed by Marti Bolivar
commit 0ab6bc6626

View file

@ -1421,6 +1421,12 @@ cleanup:
int lwm2m_send_message_async(struct lwm2m_message *msg)
{
sys_slist_append(&msg->ctx->pending_sends, &msg->node);
if (IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT) &&
IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_ENABLED)) {
engine_update_tx_time();
}
return 0;
}
@ -1452,11 +1458,6 @@ static int lwm2m_send_message(struct lwm2m_message *msg)
lwm2m_reset_message(msg, true);
}
if (IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT) &&
IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_ENABLED)) {
engine_update_tx_time();
}
return 0;
}