Commit 2d824f48 authored by Sjors Hettinga's avatar Sjors Hettinga Committed by Carles Cufi
Browse files

net: tcp: Removed copy of conn->unacked_len

In the function tcp_send_data, the variable conn->unacked_len in copied
into a local variable pos. This value is only used in one location and
used mixed with the original conn->unacked_len.

This fix removes pos and switches to use conn->unacked_len everywhere
to reduce the chance of confusion. This does not functionally change the
code.

Signed-off-by: default avatarSjors Hettinga <s.a.hettinga@gmail.com>
parent 4b9a8a84
Loading
Loading
Loading
Loading
+2 −3
Changes for subsys/net/ip/tcp.c: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -1006,10 +1006,9 @@ static int tcp_unsent_len(struct tcp *conn)
static int tcp_send_data(struct tcp *conn)
{
	int ret = 0;
	int pos, len;
	int len;
	struct net_pkt *pkt;

	pos = conn->unacked_len;
	len = MIN3(conn->send_data_total - conn->unacked_len,
		   conn->send_win - conn->unacked_len,
		   conn_mss(conn));
@@ -1026,7 +1025,7 @@ static int tcp_send_data(struct tcp *conn)
		goto out;
	}

	ret = tcp_pkt_peek(pkt, conn->send_data, pos, len);
	ret = tcp_pkt_peek(pkt, conn->send_data, conn->unacked_len, len);
	if (ret < 0) {
		tcp_pkt_unref(pkt);
		ret = -ENOBUFS;