代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/lwip 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From b23520dcddbdf088ededeac7a0a1611db73db191 Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Mon, 19 Dec 2022 19:23:42 +0800
Subject: [PATCH] skip unnecessary tcp_route
---
src/core/tcp.c | 1 +
src/core/tcp_out.c | 20 ++++++++++++++++----
src/include/lwip/tcp.h | 1 +
src/include/lwipsock.h | 1 +
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 54d9ded..b2bee67 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -2304,6 +2304,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
tcp_segs_free(pcb->unacked);
pcb->unacked = pcb->unsent = NULL;
pcb->last_unacked = pcb->last_unsent = NULL;
+ pcb->pcb_if = NULL;
#if TCP_OVERSIZE
pcb->unsent_oversize = 0;
#endif /* TCP_OVERSIZE */
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index e862f9e..99f8e66 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1428,7 +1428,12 @@ tcp_output(struct tcp_pcb *pcb)
lwip_ntohl(seg->tcphdr->seqno), pcb->lastack));
}
- netif = tcp_route(pcb, &pcb->local_ip, &pcb->remote_ip);
+ if (pcb->pcb_if == NULL) {
+ netif = tcp_route(pcb, &pcb->local_ip, &pcb->remote_ip);
+ pcb->pcb_if = netif;
+ } else {
+ netif = pcb->pcb_if;
+ }
if (netif == NULL) {
return ERR_RTE;
}
@@ -2223,14 +2228,21 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
* header checksum and calling ip_output_if while handling netif hints and stats.
*/
static err_t
-tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
+tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
const ip_addr_t *src, const ip_addr_t *dst)
{
struct netif *netif;
LWIP_ASSERT("tcp_output_control_segment: invalid pbuf", p != NULL);
- netif = tcp_route(pcb, src, dst);
+ if (pcb == NULL || pcb->pcb_if == NULL) {
+ netif = tcp_route(pcb, src, dst);
+ if (pcb) {
+ pcb->pcb_if = netif;
+ }
+ } else {
+ netif = pcb->pcb_if;
+ }
if (netif == NULL) {
pbuf_free(p);
return ERR_RTE;
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index 9ebdbf2..07b7dc0 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -408,6 +408,7 @@ struct tcp_pcb {
u8_t snd_scale;
u8_t rcv_scale;
#endif
+ struct netif* pcb_if;
};
#if TCP_PCB_HASH
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index bf0d753..3cf0062 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -110,6 +110,7 @@ struct lwip_sock {
/* stack thread all use */
struct list_node recv_list;
struct list_node send_list;
+ struct pbuf *lwip_lastdata;
struct pbuf *send_lastdata;
struct pbuf *send_pre_del;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。