net: lwm2m: remove extra ref/unref in retransmit

During the retransmit cycle we take ref on the outgoing packet,
only to immediately unref it.  Originally, this was to make sure
the net_context handling didn't get rid of the packet when
sendto() is called.  But after checking, the ref counter is never
in danger of going to 0 at this point in the code, so the
added ref handling is useless.

Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
Michael Scott 2018-09-13 08:34:38 -07:00 committed by Anas Nashif
commit 547e449f98

View file

@ -3634,9 +3634,6 @@ static void retransmit_request(struct k_work *work)
return; return;
} }
/* ref pkt to avoid being freed after net_app_send_pkt() */
net_pkt_ref(pending->pkt);
LOG_DBG("Resending message: %p", msg); LOG_DBG("Resending message: %p", msg);
msg->send_attempts++; msg->send_attempts++;
/* /*
@ -3669,8 +3666,6 @@ static void retransmit_request(struct k_work *work)
return; return;
} }
/* unref to balance ref we made for sendto() */
net_pkt_unref(pending->pkt);
k_delayed_work_submit(&client_ctx->retransmit_work, pending->timeout); k_delayed_work_submit(&client_ctx->retransmit_work, pending->timeout);
} }