!134 [sync] PR-133: sync fix write event error

From: @openeuler-sync-bot 
Reviewed-by: @wu-changsheng 
Signed-off-by: @wu-changsheng
This commit is contained in:
openeuler-ci-bot 2022-11-28 02:07:31 +00:00 committed by Gitee
commit b8d07b9f68
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 56 additions and 1 deletions

View File

@ -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

View File

@ -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 <majun65@huawei.com> - 1.0.1-23
- modify duplicate code
- fix data flow error when use NIC in kernel