net: coap: Rework pending retransmission logic
Introduce retransmission counter to the coap_pending structure. This allows to simplify the retransmission logic and allows to keep track of the number of remaining retranmissions. Additionally, extend the `coap_pending_init()` function with `retries` parameter, which allows to set the retransmission count individually for each confirmable transaction. Fixes #28117 Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
812914ff5d
commit
538e19ee2e
6 changed files with 35 additions and 25 deletions
|
@ -961,7 +961,8 @@ int lwm2m_init_message(struct lwm2m_message *msg)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
r = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr);
|
||||
r = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr,
|
||||
COAP_DEFAULT_MAX_RETRANSMIT);
|
||||
if (r < 0) {
|
||||
LOG_ERR("Unable to initialize a pending "
|
||||
"retransmission (err:%d).", r);
|
||||
|
@ -3996,7 +3997,9 @@ static int lwm2m_response_promote_to_con(struct lwm2m_message *msg)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr);
|
||||
ret = coap_pending_init(msg->pending, &msg->cpkt,
|
||||
&msg->ctx->remote_addr,
|
||||
COAP_DEFAULT_MAX_RETRANSMIT);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Unable to initialize a pending "
|
||||
"retransmission (err:%d).", ret);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue