Commit 4c45884c authored by Jukka Rissanen's avatar Jukka Rissanen Committed by Johan Hedberg
Browse files

net: tcp: Give a warning to user if packet cloning fails



If the packet cloning fails (can easily happen when working with
loopback interface and when having low net_buf count), then
print a warning to the user. Error could also be possible but
as the situation might correct itself in this case, the warning
should be enough.

Signed-off-by: default avatarJukka Rissanen <jukka.rissanen@nordicsemi.no>
parent 46a0a72b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -353,6 +353,7 @@ static void tcp_send(struct net_pkt *pkt)
			 * free the net_pkt.
			 */
			tcp_pkt_unref(pkt);
			NET_WARN("net_pkt alloc failure");
			goto out;
		}

@@ -866,6 +867,8 @@ static bool tcp_send_process_no_lock(struct tcp *conn)
			if (clone) {
				tcp_send(clone);
				conn->send_retries--;
			} else {
				NET_WARN("net_pkt alloc failure");
			}
		} else {
			unref = true;
@@ -880,7 +883,7 @@ static bool tcp_send_process_no_lock(struct tcp *conn)
					 struct net_pkt, next) :
			tcp_pkt_clone(pkt);
		if (!pkt) {
			NET_ERR("net_pkt alloc failure");
			NET_WARN("net_pkt alloc failure");
			goto out;
		}