net: tcp: Do buf ref when resending a segment
We need to check whether buf_sent was true when resending the TCP segment, and do a buf ref if needed. If this is not done, the buf will be unref after send, which will cause unpredictable results. Change-Id: Ibd4490305de88ac6ffd04ec42bba196e57da5c10 Signed-off-by: june li <junelizh@foxmail.com>
This commit is contained in:
parent
7ce82fea82
commit
504b273b85
1 changed files with 4 additions and 1 deletions
|
@ -831,7 +831,10 @@ void net_tcp_ack_received(struct net_context *ctx, uint32_t ack)
|
|||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&ctx->tcp->sent_list, buf,
|
||||
sent_list) {
|
||||
net_nbuf_set_buf_sent(buf, false);
|
||||
if (net_nbuf_buf_sent(buf)) {
|
||||
do_ref_if_needed(buf);
|
||||
net_nbuf_set_buf_sent(buf, false);
|
||||
}
|
||||
}
|
||||
|
||||
net_tcp_send_data(ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue