Giter VIP home page Giter VIP logo

Comments (3)

panjf2000 avatar panjf2000 commented on July 1, 2024

主动退出时内部涉及多个错误,这些错误和意外退出的错误的处理有重叠,比较难分开,你说的 希望在相应的函数处能够处理关闭状态,关闭时真正的错误由Engine.Stop()函数返回 我不是很理解,能具体一点吗?或者用代码展示你想要的最终效果是什么。

from gnet.

amwfhv avatar amwfhv commented on July 1, 2024

能否加一个标记用于判断是否处于关闭状态,这样在内部涉及到的错误处可以通过判断标记确认是否为主动退出,如果是主动退出就不需要输出错误的日志,比如Accept函数的返回处

from gnet.

amwfhv avatar amwfhv commented on July 1, 2024

我在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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.