Comments (3)
主动退出时内部涉及多个错误,这些错误和意外退出的错误的处理有重叠,比较难分开,你说的 希望在相应的函数处能够处理关闭状态,关闭时真正的错误由Engine.Stop()函数返回
我不是很理解,能具体一点吗?或者用代码展示你想要的最终效果是什么。
from gnet.
能否加一个标记用于判断是否处于关闭状态,这样在内部涉及到的错误处可以通过判断标记确认是否为主动退出,如果是主动退出就不需要输出错误的日志,比如Accept函数的返回处
from gnet.
我在Windows平台下面,尝试加入以下代码后主动退出就输出错误了,不确认内部还有多少涉及的地方,望评估该功能
1、engine_windows.go
engine结构加入
isStop atomic.Bool
2、engine_windows.go
start函数加入
eng.isStop.Store(false)
3、engine_windows.go
stop函数加入
eng.isStop.Store(true)
4、acceptor_windows.go
listen函数在accept后处理err时进行判断
tc, e := eng.ln.ln.Accept() if e != nil { if eng.isStop.Load() { return nil } err = e eng.opts.Logger.Errorf("Accept() fails due to error: %v", err) return }
from gnet.
Related Issues (20)
- [Question]: Server端回包立刻关闭连接,OnTraffic 收不到最后一个包的数据 HOT 11
- [Question]: ReadFrom系列函数的作用 HOT 1
- [Feature]: Support for SO_BINDTODEVICE? HOT 4
- 一条链接往外写数据,内存增长很快。 HOT 4
- [Feature]: Can this be part of the roadmap for practical use case as top priority. tls / ktls support first. HOT 8
- [Feature]: 有没有详细的教程 新手根本不知道咋用 HOT 2
- [Question]: 请教一个问题:关于使用独立的 worker pool 处理阻塞的业务逻辑 HOT 2
- 如何通知GNet关闭某个链接?[Question]: HOT 1
- [Bug]: 2.3.5 onOpen和onClose执行次数不一致 HOT 15
- [Feature]: 为 Client.Enroll/Dial 提供同步 callback HOT 9
- [Feature]: gnet.Conn 增加一个并发安全的map HOT 2
- [Question]: remoteAddr为什么是空的 HOT 3
- [Bug]: memory leaks in `conn.release`
- [Feature]: enable `OnOpen` when UDP socket is connected HOT 2
- [Question]: gnet.run()时提示错误:gnet engine is stopping with error: kevent add|clear:function not implemented HOT 2
- [Question]: gnet engine is stopping with error: kevent add|clear:function not implemented HOT 5
- [Question]: 您好大佬,这个库的epoll的底层实现是用纯go实现的吗?没有用到cgo是吧? HOT 1
- [Feature]: how to disable logging? replace uber zap with zerolog too pls HOT 3
- [Question]: The TechEmpower Benchmark is misleading, but can we make it even faster? HOT 1
- [Feature]: add synchronization for Conn to make it concurrency-safe HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gnet.