Repository navigation
fix(cooperation): cap tunnel socket read buffers for flow control - #809
Conversation
Reviewer's GuideThis PR prevents Qt from buffering unlimited incoming tunnel data in user space by setting every stream socket's read buffer to twice the credit window, allowing TCP backpressure to reach the sender; an integration-style test verifies the limit on both sides of a forwarded connection. Sequence diagram for tunnel socket backpressuresequenceDiagram
participant Sender
participant TCP
participant ReceiverSocket
participant TunnelManager
participant Receiver
Sender->>TCP: Send stream data
TCP->>ReceiverSocket: Deliver incoming bytes
ReceiverSocket->>ReceiverSocket: setReadBufferSize(kReadBufferSize)
ReceiverSocket->>TunnelManager: readyRead
TunnelManager->>Receiver: pump
ReceiverSocket-->>TCP: Buffer capped at 2 * kWindowSize
TCP-->>Sender: Apply backpressure when buffer is full
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
a827357 to
2c5e661
Compare
c247b1f to
95bb6c7
Compare
2c5e661 to
3947d06
Compare
61297ad to
4dc4ef9
Compare
3947d06 to
c5ee806
Compare
QAbstractSocket buffers incoming bytes in user space without a limit by default, draining the kernel even when the tunnel credit window is full. The sender's file server therefore never blocked and reported progress up to 100% while the receiver was still downloading a large file. Cap each tunnel stream socket at twice the credit window so TCP backpressure reaches the writer. Log: cap tunnel socket read buffers for flow control PMS: TASK-396845 Influence: large transfers apply TCP backpressure instead of reporting progress the receiver has not received.
c5ee806 to
2178710
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
| 🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: 无 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: 无 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: 无 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: 无 💡 改进建议代码示例// 当前代码已为最佳实践,无需修改。
// tunnelmanager.h
static constexpr int kReadBufferSize = 2 * kWindowSize; // 512KB,配合信用窗口流控
// tunnelmanager.cpp - setupSocket() 中在连接信号槽前设置
socket->setReadBufferSize(kReadBufferSize);本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, re2zero The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Part 6/8 of the reverse tunnel stack (recovery of #802).
This reapplies the reviewed commit on top of the corrected stack because #802 was accidentally merged into its stacked base branch instead of master.
Merge order: #805 → #806 → #807 → #808 → #809 → #810 → #811.
Retargeted to master after #808 merged.
QAbstractSocket buffers incoming bytes in user space without a limit by
default, draining the kernel even when the tunnel credit window is full.
The sender's file server therefore never blocked and reported progress up
to 100% while the receiver was still downloading a large file.
Cap each tunnel stream socket at twice the credit window so TCP
backpressure reaches the writer.
Log: cap tunnel socket read buffers for flow control
PMS: TASK-396845
Influence: large transfers apply TCP backpressure instead of reporting progress the receiver has not received.
Summary by Sourcery
Restore TCP flow control for tunnel streams by limiting socket read buffering.
Bug Fixes:
Tests: