Skip to content
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

skynet.wait中使用的session增加回绕判断 #1931

Merged
merged 2 commits into from
May 27, 2024

Conversation

mippo520
Copy link
Contributor

@@ -158,15 +164,26 @@ do ---- avoid session rewind conflict
return session
end

local function auxwait_checkrewind()
local session = c.genid()
if session and session > dangerzone_low and session <= dangerzone_up then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处可以稍微修改一下,不需要判断 session 为 nil 的情况,可以把判断次数减少到两次。因为:

https://github.com/cloudwu/skynet/blob/master/lualib-src/lua-skynet.c#L228-L234

genid 一定会返回数字(不会出错),而之前两处类似的地方都可能返回 nil (通常是出错)。

@cloudwu cloudwu merged commit 3375a59 into cloudwu:master May 27, 2024
cloudwu pushed a commit that referenced this pull request Jun 23, 2024
* skynet.wait中使用的session增加回绕判断

* 去除session判空

---------

Co-authored-by: mippo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants