1 Star 0 Fork 22

guoshuai418@163.com/gnet

forked from Gitee 极速下载/gnet 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
loop_linux.go 840 Bytes
一键复制 编辑 原始数据 按行查看 历史
andypan 提交于 2019-11-17 00:30 . Remove deprecated code
// 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/netpoll"
)
func (lp *loop) handleEvent(fd int, ev uint32) error {
if c, ok := lp.connections[fd]; ok {
switch {
// 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 !c.opened:
return lp.loopOpen(c)
case !c.outboundBuffer.IsEmpty():
if ev&netpoll.OutEvents != 0 {
return lp.loopOut(c)
}
return nil
case ev&netpoll.InEvents != 0:
return lp.loopIn(c)
default:
return nil
}
}
return lp.loopAccept(fd)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/webboyvc/gnet.git
git@gitee.com:webboyvc/gnet.git
webboyvc
gnet
gnet
master

搜索帮助