net: lwm2m: remove special handling for message id 0
Change so that the caller of lwm2m_init_message is responsible for generating a message id and remove message id generation from lwm2m_init_message. Prevents generating a new id when the caller's intent is to init a message with id 0. Fixes #28283 Signed-off-by: Pascal Brogle <pascal.brogle@husqvarnagroup.com>
This commit is contained in:
parent
18a51a0bf6
commit
32f053403f
4 changed files with 6 additions and 10 deletions
|
@ -948,8 +948,7 @@ int lwm2m_init_message(struct lwm2m_message *msg)
|
|||
}
|
||||
|
||||
r = coap_packet_init(&msg->cpkt, msg->msg_data, sizeof(msg->msg_data),
|
||||
1, msg->type, tokenlen, token, msg->code,
|
||||
(msg->mid == LWM2M_MSG_ID_GENERATE_NEW ? coap_next_id() : msg->mid));
|
||||
1, msg->type, tokenlen, token, msg->code, msg->mid);
|
||||
if (r < 0) {
|
||||
LOG_ERR("coap packet init error (err:%d)", r);
|
||||
goto cleanup;
|
||||
|
@ -3973,7 +3972,7 @@ static int generate_notify_message(struct observe_node *obs,
|
|||
|
||||
msg->type = COAP_TYPE_CON;
|
||||
msg->code = COAP_RESPONSE_CODE_CONTENT;
|
||||
msg->mid = LWM2M_MSG_ID_GENERATE_NEW;
|
||||
msg->mid = coap_next_id();
|
||||
msg->token = obs->token;
|
||||
msg->tkl = obs->tkl;
|
||||
msg->reply_cb = notify_message_reply_cb;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue