1 Star 0 Fork 48

yc555/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0029-fix-EISCONN-err-and-remove-same-customized-modificat.patch 3.84 KB
一键复制 编辑 原始数据 按行查看 历史
From ec2f5414c6c98b63376e4bce9534abc5c01ce13c Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Thu, 6 Oct 2022 18:47:06 +0800
Subject: [PATCH] fix EISCONN err and remove same customized modification
---
src/api/api_msg.c | 22 ++--------------------
src/include/lwipsock.h | 33 ++++-----------------------------
2 files changed, 6 insertions(+), 49 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 2dded75..1fedaad 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -1334,25 +1334,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
}
#if USE_LIBOS
- if (CONN_TYPE_IS_HOST(conn)) {
- LWIP_DEBUGF(API_MSG_DEBUG,
- ("libos outgoing connection abort fd=%d\n", conn->socket));
- return ERR_ABRT;
- }
-
- LWIP_DEBUGF(API_MSG_DEBUG, ("libos outgoing connection established\n"));
- if (CONN_TYPE_HAS_INPRG(conn) && CONN_TYPE_HAS_HOST(conn)) {
- int s = conn->socket;
- struct lwip_sock *sock = get_socket_without_errno(s);
-
- if (!!sock) {
- posix_api->shutdown_fn(s, SHUT_RDWR);
- LWIP_DEBUGF(API_MSG_DEBUG,
- ("linux outgoing connection abort fd=%d\n", s));
- }
- }
- SET_CONN_TYPE_LIBOS(conn);
- add_epoll_event(conn, EPOLLOUT);
+ gazelle_connected_callback(conn);
#endif
LWIP_ASSERT("conn->state == NETCONN_CONNECT", conn->state == NETCONN_CONNECT);
@@ -1417,7 +1399,7 @@ lwip_netconn_do_connect(void *m)
/* Prevent connect while doing any other action. */
if (msg->conn->state == NETCONN_CONNECT) {
err = ERR_ALREADY;
- } else if (msg->conn->pcb.tcp->state != ESTABLISHED) {
+ } else if (msg->conn->pcb.tcp->state == ESTABLISHED) {
err = ERR_ISCONN;
} else {
setup_tcp(msg->conn);
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index 3c5c44b..912d471 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -93,13 +93,14 @@ struct lwip_sock {
#endif
#if USE_LIBOS
+ struct pbuf *send_lastdata;
+ uint16_t send_datalen;
volatile uint32_t events __rte_cache_aligned; /* available events */
struct pbuf *recv_lastdata __rte_cache_aligned; /* unread data in one pbuf */
struct list_node recv_list __rte_cache_aligned;
struct list_node event_list __rte_cache_aligned;
struct list_node send_list __rte_cache_aligned;
uint32_t in_send __rte_cache_aligned; /* avoid sock too much send rpc msg*/
- uint32_t send_flag __rte_cache_aligned; /* avoid sock too much send rpc msg*/
uint32_t epoll_events; /* registered events, EPOLLONESHOT write frequently */
char pad __rte_cache_aligned;
@@ -124,38 +125,12 @@ struct lwip_sock {
#if USE_LIBOS
extern uint32_t sockets_num;
extern struct lwip_sock *sockets;
-/**
- * Map a externally used socket index to the internal socket representation.
- *
- * @param s externally used socket index
- * @return struct lwip_sock for the socket or NULL if not found
- */
-static inline struct lwip_sock *
-get_socket_without_errno(int s)
-{
- struct lwip_sock *sock = NULL;
-
- s -= LWIP_SOCKET_OFFSET;
-
- if ((s < 0) || (s >= sockets_num)) {
- LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", s + LWIP_SOCKET_OFFSET));
- return NULL;
- }
-
- sock = &sockets[s];
-
- if (!sock->conn) {
- LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): not active\n", s + LWIP_SOCKET_OFFSET));
- return NULL;
- }
-
- return sock;
-}
-
+extern void gazelle_connected_callback(struct netconn *conn);
extern void add_recv_list(int32_t fd);
extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apiflags);
extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags);
extern void gazelle_init_sock(int32_t fd);
+extern void write_lwip_over(struct lwip_sock *sock, uint32_t n);
#endif /* USE_LIBOS */
struct lwip_sock *get_socket(int s);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangchen555/lwip.git
git@gitee.com:yangchen555/lwip.git
yangchen555
lwip
lwip
master

搜索帮助