代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 40531107531c4891defa71f899cbe96d30db9c6e Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Wed, 16 Mar 2022 16:05:46 +0800
Subject: [PATCH 33/34] fix accept check remain conn
---
src/lstack/core/lstack_protocol_stack.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 3193eeb..4a46044 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -577,17 +577,9 @@ void stack_accept(struct rpc_msg *msg)
{
int32_t fd = msg->args[MSG_ARG_0].i;
- /* listen sock attach_fd is self */
- struct lwip_sock *sock = get_socket(fd);
- if (sock == NULL) {
- msg->result = -1;
- return;
- }
- fd = sock->attach_fd;
-
int32_t accept_fd = lwip_accept(fd, msg->args[MSG_ARG_1].p, msg->args[MSG_ARG_2].p);
if (accept_fd > 0) {
- sock = get_socket(accept_fd);
+ struct lwip_sock *sock = get_socket(accept_fd);
if (sock && sock->stack) {
msg->result = accept_fd;
return;
@@ -773,13 +765,19 @@ int32_t stack_broadcast_listen(int32_t fd, int32_t backlog)
/* ergodic the protocol stack thread to find the connection, because all threads are listening */
int32_t stack_broadcast_accept(int32_t fd, struct sockaddr *addr, socklen_t *addrlen)
{
- struct lwip_sock *min_sock = NULL;
+ struct lwip_sock *sock = get_socket(fd);
+ if (sock == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ fd = sock->attach_fd;
int32_t head_fd = fd;
- int32_t min_fd = fd;
- int32_t ret = -1;
+ struct lwip_sock *min_sock = NULL;
+ int32_t min_fd = fd;
while (fd > 0) {
- struct lwip_sock *sock = get_socket(fd);
+ sock = get_socket(fd);
if (sock == NULL) {
GAZELLE_RETURN(EINVAL);
}
@@ -797,13 +795,14 @@ int32_t stack_broadcast_accept(int32_t fd, struct sockaddr *addr, socklen_t *add
fd = sock->nextfd;
}
+ int32_t ret = -1;
if (min_sock) {
ret = rpc_call_accept(min_fd, addr, addrlen);
}
- struct lwip_sock *sock = get_socket(head_fd);
if (have_accept_event(head_fd)) {
add_self_event(sock, EPOLLIN);
+ sock = get_socket(head_fd);
sock->stack->stats.accept_events++;
}
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。