fix: guard snell pooled connection reuse state#2878
Merged
Conversation
f513c49 to
d67572b
Compare
995cda3 to
75540c3
Compare
Only return a Snell connection to the pool after the request header is written and the connection is marked reusable. Close the raw connection when it is closed before a request starts or before it becomes reusable, so the next request cannot inherit incomplete state. Add Close and CloseWrite tests for early close, close after half-close, and cases where the pool must not reuse the connection.
75540c3 to
f064472
Compare
missuo
added a commit
to missuo/mihomo
that referenced
this pull request
Jun 14, 2026
Sync 15 commits from MetaCubeX/mihomo upstream (rematch outbound type, routing-mark for listeners/dns, xhttp session-table/length, AmneziaWG and OpenVPN crash fixes, etc.). Resolve snell conflicts by combining the local connection-reuse changes (uses cap + drain-before-reuse) with upstream's MarkReusable reusable- state gate (MetaCubeX#2878): a pooled conn is now returned only after it is both explicitly marked reusable and drained clean. Adapt the snell pool tests to the new gate and keep upstream's reusable-state coverage.
icy37785
pushed a commit
to icy37785/mihomo
that referenced
this pull request
Jun 27, 2026
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.
当前 mihomo 使用 Snell reuse 连接官方 snell-server 时,在某些提前关闭路径下可能触发服务端报错: