1 Star 0 Fork 32

misaka00251/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0142-fix-write-event-error.patch 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
compile_success 提交于 2022-11-26 13:30 . sync fix write event error
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/misaka00251/gazelle.git
git@gitee.com:misaka00251/gazelle.git
misaka00251
gazelle
gazelle
master

搜索帮助