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

当调用Read和Write后,修改UDPSession的超时时间不生效 #259

Open
WSitong opened this issue Mar 11, 2024 · 1 comment
Open

Comments

@WSitong
Copy link

WSitong commented Mar 11, 2024

当UDPSession调用read和write后,重新设置超时时间不会生效。查看sess.go,修改超时时间会调用:notifyReadEvent(),实际上是往s.chReadEvent写一个空结构体。在Read函数里245行,当收到 <-s.chReadEvent 事件后,会进入下一个循环,但这个循环并不会使用新的超时时间。当我把sess.go 201-206行代码放入for循环顶部,似乎可以正常工作。

发现这个问题是因为,我将http服务器传输协议从TCP换成KCP之后,websocket握手会超时,原因是调用http.response.Hijack()会导致阻塞,因为net/http/server.go第729行cr.conn.rwc.SetReadDeadline(aLongTimeAgo)尝试修改udpsession立即超时没有生效。

Hijack无法正常使用会影响http协议升级成其他协议,希望早点修复

@WSitong WSitong changed the title UDPSession设置超时时间有bug 当调用Read和Write后,修改UDPSession的超时时间不生效 Mar 11, 2024
xtaci added a commit that referenced this issue Mar 11, 2024
@xtaci
Copy link
Owner

xtaci commented Mar 11, 2024

d26364a

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

No branches or pull requests

2 participants