mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Compare commits
3 Commits
f2ec0cd5f3
...
8d595fd41f
Author | SHA1 | Date | |
---|---|---|---|
|
8d595fd41f | ||
|
063836fe5d | ||
|
3051f013f2 |
|
@ -256,7 +256,7 @@ func NewHTTP2Client(dialFn DialFn, tlsConfig *tls.Config, Fingerprint string, re
|
||||||
TLSClientConfig: tlsConfig,
|
TLSClientConfig: tlsConfig,
|
||||||
AllowHTTP: false,
|
AllowHTTP: false,
|
||||||
DisableCompression: true,
|
DisableCompression: true,
|
||||||
PingTimeout: 0,
|
ReadIdleTimeout: 15 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &wrap
|
return &wrap
|
||||||
|
|
|
@ -62,7 +62,7 @@ const (
|
||||||
// Flag.
|
// Flag.
|
||||||
defaultStartupFullLossCount = 8
|
defaultStartupFullLossCount = 8
|
||||||
quicBbr2DefaultLossThreshold = 0.02
|
quicBbr2DefaultLossThreshold = 0.02
|
||||||
maxBbrBurstPackets = 3
|
maxBbrBurstPackets = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
type bbrMode int
|
type bbrMode int
|
||||||
|
@ -334,6 +334,8 @@ func (b *bbrSender) OnPacketSent(
|
||||||
}
|
}
|
||||||
|
|
||||||
b.sampler.OnPacketSent(sentTime, packetNumber, bytes, bytesInFlight, isRetransmittable)
|
b.sampler.OnPacketSent(sentTime, packetNumber, bytes, bytesInFlight, isRetransmittable)
|
||||||
|
|
||||||
|
b.maybeAppLimited(bytesInFlight)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanSend implements the SendAlgorithm interface.
|
// CanSend implements the SendAlgorithm interface.
|
||||||
|
@ -413,8 +415,6 @@ func (b *bbrSender) OnCongestionEventEx(priorInFlight congestion.ByteCount, even
|
||||||
// packet in lost_packets.
|
// packet in lost_packets.
|
||||||
var lastPacketSendState sendTimeState
|
var lastPacketSendState sendTimeState
|
||||||
|
|
||||||
b.maybeApplimited(priorInFlight)
|
|
||||||
|
|
||||||
// Update bytesInFlight
|
// Update bytesInFlight
|
||||||
b.bytesInFlight = priorInFlight
|
b.bytesInFlight = priorInFlight
|
||||||
for _, p := range ackedPackets {
|
for _, p := range ackedPackets {
|
||||||
|
@ -541,7 +541,7 @@ func (b *bbrSender) setDrainGain(drainGain float64) {
|
||||||
b.drainGain = drainGain
|
b.drainGain = drainGain
|
||||||
}
|
}
|
||||||
|
|
||||||
// What's the current estimated bandwidth in bytes per second.
|
// Get the current bandwidth estimate. Note that Bandwidth is in bits per second.
|
||||||
func (b *bbrSender) bandwidthEstimate() Bandwidth {
|
func (b *bbrSender) bandwidthEstimate() Bandwidth {
|
||||||
return b.maxBandwidth.GetBest()
|
return b.maxBandwidth.GetBest()
|
||||||
}
|
}
|
||||||
|
@ -700,14 +700,13 @@ func (b *bbrSender) checkIfFullBandwidthReached(lastPacketSendState *sendTimeSta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bbrSender) maybeApplimited(bytesInFlight congestion.ByteCount) {
|
func (b *bbrSender) maybeAppLimited(bytesInFlight congestion.ByteCount) {
|
||||||
congestionWindow := b.GetCongestionWindow()
|
congestionWindow := b.GetCongestionWindow()
|
||||||
if bytesInFlight >= congestionWindow {
|
if bytesInFlight >= congestionWindow {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
availableBytes := congestionWindow - bytesInFlight
|
availableBytes := congestionWindow - bytesInFlight
|
||||||
drainLimited := b.mode == bbrModeDrain && bytesInFlight > congestionWindow/2
|
if availableBytes > maxBbrBurstPackets*b.maxDatagramSize {
|
||||||
if !drainLimited || availableBytes > maxBbrBurstPackets*b.maxDatagramSize {
|
|
||||||
b.sampler.OnAppLimited()
|
b.sampler.OnAppLimited()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user