-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize unregister pollerEvent in macos platform #50
base: master
Are you sure you want to change the base?
Conversation
brynet/include/brynet/net/TcpConnection.hpp Lines 826 to 835 in 5df8f95
brynet/include/brynet/net/TcpConnection.hpp Lines 182 to 188 in 5df8f95
可以从这个请求断开看 procCloseInLoop 函数的流程,就能看到socket本身可能是没有断开的(所以要unRegister,表示不处理此socket事件了)。
另外,Brynet的TcpConnection里没有手动closesocket操作,我们是使用 brynet/include/brynet/net/TcpConnection.hpp Lines 1056 to 1057 in 5df8f95
来自动管理socket。 也就是只有当TCPConnection资源释放时,才closesocket。 |
@overtalk 感谢PR,我们可以就此问题多探讨。 一方面为了资源安全,另一方面为了处理linux和windows(IOCP)的差异性,做了不少不清晰的代码。 |
@IronsDu 看ARK项目用到了你的网络库,特意来学习一波。针对你上面说的我回头再仔细研究一些你的代码哈。 |
之前说的不台严谨,其实socket的资源部受限于session的生命周期。 brynet/include/brynet/net/TcpConnection.hpp Line 842 in 5df8f95
|
kqueue 会在 fd 被 closed 之后自动移除该 fd 上的所有事件,所以 kqueue 是不需要手动删除 fd 的事件的,看 kqueue 的 manual:
https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2