From 89076d609ba50d7be9791f801af76c472fea5148 Mon Sep 17 00:00:00 2001 From: compile_success <980965867@qq.com> Date: Sat, 26 Nov 2022 13:30:44 +0000 Subject: [PATCH] sync fix write event error (cherry picked from commit a59d27aec249fd9c45e86cdfc0f443baa58c8d5e) --- 0142-fix-write-event-error.patch | 51 ++++++++++++++++++++++++++++++++ gazelle.spec | 6 +++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 0142-fix-write-event-error.patch diff --git a/0142-fix-write-event-error.patch b/0142-fix-write-event-error.patch new file mode 100644 index 0000000..f4df6fa --- /dev/null +++ b/0142-fix-write-event-error.patch @@ -0,0 +1,51 @@ +From cc46783d0b4e309279b32367a222b19f2bb6defd Mon Sep 17 00:00:00 2001 +From: compile_success <980965867@qq.com> +Date: Fri, 18 Nov 2022 12:21:49 +0000 +Subject: [PATCH] fix write event error + +--- + src/lstack/api/lstack_epoll.c | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c +index 19dd69a..02889d6 100644 +--- a/src/lstack/api/lstack_epoll.c ++++ b/src/lstack/api/lstack_epoll.c +@@ -128,7 +128,24 @@ static uint32_t update_events(struct lwip_sock *sock) + + static void raise_pending_events(struct wakeup_poll *wakeup, struct lwip_sock *sock) + { +- sock->events = update_events(sock); ++ uint32_t event = 0; ++ ++ if (NETCONN_IS_DATAIN(sock) || NETCONN_IS_ACCEPTIN(sock)) { ++ event |= EPOLLIN; ++ } ++ ++ if (NETCONN_IS_OUTIDLE(sock)) { ++ /* lwip_netconn_do_connected set LIBOS FLAGS when connected */ ++ if (sock->conn && CONN_TYPE_IS_LIBOS(sock->conn)) { ++ event |= EPOLLOUT; ++ } ++ } ++ ++ if (sock->errevent > 0) { ++ event |= EPOLLERR | EPOLLIN; ++ } ++ ++ sock->events = event; + if (sock->events) { + pthread_spin_lock(&wakeup->event_list_lock); + if (wakeup->type == WAKEUP_EPOLL && list_is_null(&sock->event_list)) { +@@ -361,7 +378,7 @@ static int32_t epoll_lwip_event(struct wakeup_poll *wakeup, struct epoll_event * + sock->epoll_events = 0; + } + +- events[event_num].events = sock->events; ++ events[event_num].events = sock->events & sock->epoll_events; + events[event_num].data = sock->ep_data; + event_num++; + +-- +2.33.0 + diff --git a/gazelle.spec b/gazelle.spec index 62cae11..18175ab 100644 --- a/gazelle.spec +++ b/gazelle.spec @@ -2,7 +2,7 @@ Name: gazelle Version: 1.0.1 -Release: 23 +Release: 24 Summary: gazelle is a high performance user-mode stack License: MulanPSL-2.0 URL: https://gitee.com/openeuler/gazelle @@ -156,6 +156,7 @@ Patch9138: 0138-avoid-send-stop-when-mbuf-pool-empty.patch Patch9139: 0139-fix-pcb-snd_buf-flip.patch Patch9140: 0140-fix-lwip-send-return-0-add-err-event.patch Patch9141: 0141-fix-data-flow-error-when-use-NIC-in-kernel.patch +Patch9142: 0142-fix-write-event-error.patch %description %{name} is a high performance user-mode stack. @@ -196,6 +197,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b %config(noreplace) %{conf_path}/ltran.conf %changelog +* Sat Nov 26 UTC compile_success <980965867@qq.com> - 1.0.1-24 +- fix write event error + * Wed Nov 16 2022 kircher - 1.0.1-23 - modify duplicate code - fix data flow error when use NIC in kernel