Skip to content

Commit fb1ae21

Browse files
committed
chore: remove unused code
1 parent 90f47a6 commit fb1ae21

File tree

7 files changed

+5
-63
lines changed

7 files changed

+5
-63
lines changed

transport/tuic/common/congestion.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,20 @@ func SetCongestionController(quicConn *quic.Conn, cc string, cwnd int) {
2121
case "cubic":
2222
quicConn.SetCongestionControl(
2323
congestion.NewCubicSender(
24-
congestion.DefaultClock{},
2524
congestion.GetInitialPacketSize(quicConn),
2625
false,
2726
),
2827
)
2928
case "new_reno":
3029
quicConn.SetCongestionControl(
3130
congestion.NewCubicSender(
32-
congestion.DefaultClock{},
3331
congestion.GetInitialPacketSize(quicConn),
3432
true,
3533
),
3634
)
3735
case "bbr_meta_v1":
3836
quicConn.SetCongestionControl(
3937
congestion.NewBBRSender(
40-
congestion.DefaultClock{},
4138
congestion.GetInitialPacketSize(quicConn),
4239
c.ByteCount(cwnd)*congestion.InitialMaxDatagramSize,
4340
congestion.DefaultBBRMaxCongestionWindow*congestion.InitialMaxDatagramSize,
@@ -48,7 +45,6 @@ func SetCongestionController(quicConn *quic.Conn, cc string, cwnd int) {
4845
case "bbr":
4946
quicConn.SetCongestionControl(
5047
congestionv2.NewBbrSender(
51-
congestionv2.DefaultClock{},
5248
congestionv2.GetInitialPacketSize(quicConn),
5349
c.ByteCount(cwnd),
5450
),

transport/tuic/congestion/bbr_sender.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ const (
101101

102102
type bbrSender struct {
103103
mode bbrMode
104-
clock Clock
105104
rttStats congestion.RTTStatsProvider
106105
bytesInFlight congestion.ByteCount
107106
// return total bytes of unacked packets.
@@ -232,14 +231,12 @@ type bbrSender struct {
232231
}
233232

234233
func NewBBRSender(
235-
clock Clock,
236234
initialMaxDatagramSize,
237235
initialCongestionWindow,
238236
initialMaxCongestionWindow congestion.ByteCount,
239237
) *bbrSender {
240238
b := &bbrSender{
241239
mode: STARTUP,
242-
clock: clock,
243240
sampler: NewBandwidthSampler(),
244241
maxBandwidth: NewWindowedFilter(int64(BandwidthWindowSize), MaxFilter),
245242
maxAckHeight: NewWindowedFilter(int64(BandwidthWindowSize), MaxFilter),

transport/tuic/congestion/clock.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

transport/tuic/congestion/cubic.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ const betaLastMax float32 = 0.85
3737

3838
// Cubic implements the cubic algorithm from TCP
3939
type Cubic struct {
40-
clock Clock
41-
4240
// Number of connections to simulate.
4341
numConnections int
4442

@@ -67,9 +65,8 @@ type Cubic struct {
6765
}
6866

6967
// NewCubic returns a new Cubic instance
70-
func NewCubic(clock Clock) *Cubic {
68+
func NewCubic() *Cubic {
7169
c := &Cubic{
72-
clock: clock,
7370
numConnections: defaultNumConnections,
7471
}
7572
c.Reset()

transport/tuic/congestion/cubic_sender.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type cubicSender struct {
2323
rttStats congestion.RTTStatsProvider
2424
cubic *Cubic
2525
pacer *pacer
26-
clock Clock
2726

2827
reno bool
2928

@@ -61,12 +60,10 @@ var (
6160

6261
// NewCubicSender makes a new cubic sender
6362
func NewCubicSender(
64-
clock Clock,
6563
initialMaxDatagramSize congestion.ByteCount,
6664
reno bool,
6765
) *cubicSender {
6866
return newCubicSender(
69-
clock,
7067
reno,
7168
initialMaxDatagramSize,
7269
initialCongestionWindow*initialMaxDatagramSize,
@@ -75,7 +72,6 @@ func NewCubicSender(
7572
}
7673

7774
func newCubicSender(
78-
clock Clock,
7975
reno bool,
8076
initialMaxDatagramSize,
8177
initialCongestionWindow,
@@ -89,8 +85,7 @@ func newCubicSender(
8985
initialMaxCongestionWindow: initialMaxCongestionWindow,
9086
congestionWindow: initialCongestionWindow,
9187
slowStartThreshold: MaxByteCount,
92-
cubic: NewCubic(clock),
93-
clock: clock,
88+
cubic: NewCubic(),
9489
reno: reno,
9590
maxDatagramSize: initialMaxDatagramSize,
9691
}

transport/tuic/congestion_v2/bbr_sender.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ const (
9696

9797
type bbrSender struct {
9898
rttStats congestion.RTTStatsProvider
99-
clock Clock
10099
pacer *Pacer
101100

102101
mode bbrMode
@@ -244,26 +243,22 @@ type bbrSender struct {
244243
var _ congestion.CongestionControl = &bbrSender{}
245244

246245
func NewBbrSender(
247-
clock Clock,
248246
initialMaxDatagramSize congestion.ByteCount,
249247
initialCongestionWindowPackets congestion.ByteCount,
250248
) *bbrSender {
251249
return newBbrSender(
252-
clock,
253250
initialMaxDatagramSize,
254251
initialCongestionWindowPackets*initialMaxDatagramSize,
255252
congestion.MaxCongestionWindowPackets*initialMaxDatagramSize,
256253
)
257254
}
258255

259256
func newBbrSender(
260-
clock Clock,
261257
initialMaxDatagramSize,
262258
initialCongestionWindow,
263259
initialMaxCongestionWindow congestion.ByteCount,
264260
) *bbrSender {
265261
b := &bbrSender{
266-
clock: clock,
267262
mode: bbrModeStartup,
268263
sampler: newBandwidthSampler(roundTripCount(bandwidthWindowSize)),
269264
lastSentPacket: invalidPacketNumber,
@@ -297,7 +292,7 @@ func newBbrSender(
297292
}
298293
*/
299294

300-
b.enterStartupMode(b.clock.Now())
295+
b.enterStartupMode()
301296
b.setHighCwndGain(derivedHighCWNDGain)
302297

303298
return b
@@ -605,7 +600,7 @@ func (b *bbrSender) maybeUpdateMinRtt(now monotime.Time, sampleMinRtt time.Durat
605600
}
606601

607602
// Enters the STARTUP mode.
608-
func (b *bbrSender) enterStartupMode(now monotime.Time) {
603+
func (b *bbrSender) enterStartupMode() {
609604
b.mode = bbrModeStartup
610605
// b.maybeTraceStateChange(logging.CongestionStateStartup)
611606
b.pacingGain = b.highGain
@@ -757,7 +752,7 @@ func (b *bbrSender) maybeEnterOrExitProbeRtt(now monotime.Time, isRoundStart, mi
757752
if now.Sub(b.exitProbeRttAt) >= 0 && b.probeRttRoundPassed {
758753
b.minRttTimestamp = now
759754
if !b.isAtFullBandwidth {
760-
b.enterStartupMode(now)
755+
b.enterStartupMode()
761756
} else {
762757
b.enterProbeBandwidthMode(now)
763758
}

transport/tuic/congestion_v2/clock.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)