gazelle/0261-fix-bond4-EPOLLOUT-event-error.patch
chengyechun ab5a5149ab sync fix bond4 EPOLLOUT event error
(cherry picked from commit 7ecd02724564fe72b2ad772c2faa63be949a3823)
2023-07-06 15:51:10 +08:00

64 lines
2.1 KiB
Diff

From 0e6863306602e58e21932ed9b5fccf269e77e1da Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Wed, 28 Jun 2023 11:40:36 +0000
Subject: [PATCH] fix bond4 EPOLLOUT event error
---
src/lstack/api/lstack_epoll.c | 12 ++++++------
src/lstack/core/lstack_lwip.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index 06bd71b..55ca4fe 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -140,6 +140,11 @@ static void raise_pending_events(struct wakeup_poll *wakeup, struct lwip_sock *s
event |= EPOLLIN;
}
+ if (sock->errevent > 0) {
+ event |= EPOLLERR | EPOLLIN;
+ }
+
+ pthread_spin_lock(&wakeup->event_list_lock);
if (NETCONN_IS_OUTIDLE(sock)) {
/* lwip_netconn_do_connected set LIBOS FLAGS when connected */
if (sock->conn && CONN_TYPE_IS_LIBOS(sock->conn)) {
@@ -147,19 +152,14 @@ static void raise_pending_events(struct wakeup_poll *wakeup, struct lwip_sock *s
}
}
- if (sock->errevent > 0) {
- event |= EPOLLERR | EPOLLIN;
- }
-
if (event) {
- pthread_spin_lock(&wakeup->event_list_lock);
sock->events = event;
if (wakeup->type == WAKEUP_EPOLL && (sock->events & sock->epoll_events) &&
list_is_null(&sock->event_list)) {
list_add_node(&wakeup->event_list, &sock->event_list);
}
- pthread_spin_unlock(&wakeup->event_list_lock);
}
+ pthread_spin_unlock(&wakeup->event_list_lock);
}
int32_t lstack_do_epoll_create(int32_t fd)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index d53591d..c1346f6 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -645,7 +645,7 @@ static inline bool replenish_send_ring(struct protocol_stack *stack, struct lwip
replenish_again = replenish_send_idlembuf(stack, sock);
- if ((sock->epoll_events & EPOLLOUT) && NETCONN_IS_OUTIDLE(sock)) {
+ if (NETCONN_IS_OUTIDLE(sock)) {
add_sock_event(sock, EPOLLOUT);
}
--
2.23.0