Repository navigation
Direct/Freedom outbound: Close blocked connections after blockDelay (VLESS, Hysteria, etc.) - #7238
Open
solodecode wants to merge 2 commits into
Open
solodecode wants to merge 2 commits into
solodecode wants to merge 2 commits into
Conversation
… (VLESS, Hysteria, etc.) blackhole waited for buf.Copy(input, buf.Discard) and relied on the blockDelay timer calling common.Interrupt(input) to end it. Inbounds that call DispatchLink (VLESS, Hysteria, SOCKS, HTTP CONNECT, dokodemo-door, TUN, WireGuard, MASQUE) pass a reader on the client connection, which Interrupt does not stop, so a blocked connection stayed open until the client closed it. Drain the input in a goroutine and return once the delay has passed or the input has ended. The inbound then closes the client connection.
solodecode
force-pushed
the
freedom-block-delay
branch
from
October 23, 2026 01:23
e0da81a to
29fe9cb
Compare
Collaborator
|
改用 time.After |
Author
|
switched to |
Meo597
approved these changes
Oct 23, 2026
Meo597
left a comment
Collaborator
There was a problem hiding this comment.
单看黑洞效果和以前是相同的,修的其实是如果客户端静默断开了,connIdle 又没生效,保证到期后强制回收掉连接。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regression from #6060 (958eb9e).
blackholewaits forbuf.Copy(input, buf.Discard)and relies on theblockDelaytimer callingcommon.Interrupt(input)to end it. That only works for a pipe: VLESS, Hysteria and other inbounds that useDispatchLinkpass a reader on the client connection, andInterruptdoes nothing to it. So a blocked connection stays open until the client closes it, whateverblockDelayis. In our tests it was still open after 330 s, longer thanconnIdle.Drain the input in a goroutine and return once the delay has passed or the input has ended. The inbound then closes the connection, as it does after the blackhole outbound.
TestVlessBlockDelaycoversblockDelay0 and 1 through a VLESS inbound. Both cases fail on main.