fix: transport scheduling flow control - #107
Merged
Merged
Conversation
On macOS the app is often launched by Finder/launchd with cwd=/, so relative paths in config (direct_file, proxy_file, ca_path, cert_path, key_path, next_proxy_file and the server's -c config file) could not be read even though the files sit next to the binary/.app bundle. Add util.ResolvePath and apply it to all file path fields in both client and server configs.
…tes bidirectionally
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.
背景
对
config/types.go默认参数的审查发现了三个影响实际吞吐/行为的问题:grow()对 bulk 流使用[prioritySlots, live)范围,当
live < prioritySlots时该范围为空直接返回,而连接池只能靠 priority 流(80/443 等端口)扩容。BT/下载器等纯下载场景会永远停在初始 2 条连接上,heavy 流隔离、多连接抗限速全部失效。
HTTP/2 单流上行吞吐 ≈ 窗口/RTT,300ms RTT 链路上单流上传被硬性封顶在 ~6.8Mbps。
connBytesRecv只在trackRead累加,上传型流量永不触发conn_max_bytes轮换,而中间盒按字节限速对上行同样生效。修改
transport/http2/scheduler.go:新增growRange(),bulk 范围为空时回退到全量[0, live)范围按bulkThreshold判定,与pick()的调度行为对齐;首查与锁内复查统一。config/types.go+server/server.go:服务端上行流控窗口每流 256KB→1MB、每连接 1MB→4MB;抽取
buildHTTPServer()供测试直接构造。transport/http2/:connBytesRecv重命名为connBytes,trackWrite/trackRead双向累加;
bytesRecv仍只统计下行,降级检测的吞吐采样语义不变。测试
TestGrowBulkOnlyWorkloadGrowsPool等 3 个调度器用例:纯 bulk 负载逐条扩容、bulk 范围非空后使用专属范围、priority 行为回归。
TestBuildHTTPServerUploadFlowControl+TestServerUploadFlowControlWindowsOnWire:以字面量下限断言窗口配置,并在真实 TLS+h2 连接上解析服务端 SETTINGS /
WINDOW_UPDATE 验证对端实际看到的窗口。
TestHTTP2Stream_ConnBytesCountsBothDirections等:上行计入轮换字节、下行吞吐采样不混入、nil-slot 守卫。
验证
go build ./...、go vet、go test ./...、make lint全部通过。影响与风险