Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions Sources/SwiftNetwork/QUIC/FlowControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -709,22 +709,9 @@ extension QUICStreamInstance {
return false
}

var largestPathMSS: UInt64 = 0
var largestPathRTT: NetworkDuration = .zero

connection.applyToAllPaths { path in
if path.mss > largestPathMSS {
largestPathMSS = UInt64(path.mss)
}
if path.rtt.smoothedRTT > largestPathRTT {
largestPathRTT = path.rtt.smoothedRTT
}
}

let increment = computeReceiveHighWaterMarkIncrease(
dataLength: dataLengthAdded,
rtt: largestPathRTT,
mss: largestPathMSS,
connection: connection,
now: connection.now
)

Expand All @@ -749,8 +736,7 @@ extension QUICStreamInstance {

fileprivate func computeReceiveHighWaterMarkIncrease(
dataLength: UInt64,
rtt: NetworkDuration,
mss: UInt64,
connection: QUICConnection,
now: NetworkClock.Instant
) -> UInt64 {
if flowControlStreamState.receiveHighWaterMarkTime > now {
Expand All @@ -765,10 +751,12 @@ extension QUICStreamInstance {
// Here, we estimate if the bandwidth measured in this RTT
// is more than a certain value of the bandwidth measured
// in the previous RTT.
let rtt = connection.currentPath?.smoothedRTT ?? .zero
if now >= flowControlStreamState.receiveHighWaterMarkTime.advanced(by: rtt) {
if flowControlStreamState.receiveHighWaterMarkCount
> flowControlStreamState.receiveHighWaterMarkPreviousCount
{
let mss = UInt64(connection.currentPath?.mss ?? 0)
let shift: Int
if flowControlStreamState.receiveHighWaterMarkCount
> (flowControlStreamState.receiveHighWaterMarkPreviousCount
Expand Down
1 change: 1 addition & 0 deletions Sources/SwiftNetwork/QUIC/QUICPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ public final class QUICPath: MultiplexingDatagramPath<QUICConnection>, Equatable

var isRouteEstablished: Bool { state.isRouteEstablished }

@_optimize(speed)
var smoothedRTT: NetworkDuration {
rtt.smoothedRTT
}
Expand Down
Loading