1 Star 0 Fork 22

Zachery/gnet

forked from Gitee 极速下载/gnet 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
loop_linux.go 823 Bytes
一键复制 编辑 原始数据 按行查看 历史
// Copyright 2019 Andy Pan. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
// +build linux
package gnet
import "github.com/panjf2000/gnet/internal/netpoll"
func (el *eventloop) handleEvent(fd int, ev uint32) error {
if c, ok := el.connections[fd]; ok {
switch c.outboundBuffer.IsEmpty() {
// Don't change the ordering of processing EPOLLOUT | EPOLLRDHUP / EPOLLIN unless you're 100%
// sure what you're doing!
// Re-ordering can easily introduce bugs and bad side-effects, as I found out painfully in the past.
case false:
if ev&netpoll.OutEvents != 0 {
return el.loopWrite(c)
}
return nil
case true:
if ev&netpoll.InEvents != 0 {
return el.loopRead(c)
}
return nil
}
}
return el.loopAccept(fd)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/c86/gnet.git
git@gitee.com:c86/gnet.git
c86
gnet
gnet
master

搜索帮助