initialised newreno in tests
This commit is contained in:
parent
9258bfec77
commit
e1241b2cf0
@ -21,8 +21,8 @@ type newRenoTest struct {
|
||||
halfRtt time.Duration
|
||||
}
|
||||
|
||||
func newNewRenoTest(rtt time.Duration) *newRenoTest {
|
||||
return &newRenoTest{
|
||||
func newNewRenoTest(ctx context.Context, rtt time.Duration) *newRenoTest {
|
||||
nr := &newRenoTest{
|
||||
sideA: NewNewReno(),
|
||||
sideB: NewNewReno(),
|
||||
|
||||
@ -34,6 +34,12 @@ func newNewRenoTest(rtt time.Duration) *newRenoTest {
|
||||
|
||||
halfRtt: rtt / 2,
|
||||
}
|
||||
|
||||
p, _ := nr.sideA.Initial(ctx)
|
||||
p, _, _ = nr.sideB.Handle(ctx, p)
|
||||
p, _, _ = nr.sideA.Handle(ctx, p)
|
||||
|
||||
return nr
|
||||
}
|
||||
|
||||
func (n *newRenoTest) Start(ctx context.Context) {
|
||||
@ -151,7 +157,7 @@ func TestNewReno_Congestion(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
c := newNewRenoTest(rtt)
|
||||
c := newNewRenoTest(ctx, rtt)
|
||||
c.Start(ctx)
|
||||
c.RunSideA(ctx)
|
||||
c.RunSideB(ctx)
|
||||
@ -189,7 +195,7 @@ func TestNewReno_Congestion(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
c := newNewRenoTest(rtt)
|
||||
c := newNewRenoTest(ctx, rtt)
|
||||
c.Start(ctx)
|
||||
c.RunSideA(ctx)
|
||||
c.RunSideB(ctx)
|
||||
@ -233,7 +239,7 @@ func TestNewReno_Congestion(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
c := newNewRenoTest(rtt)
|
||||
c := newNewRenoTest(ctx, rtt)
|
||||
c.Start(ctx)
|
||||
c.RunSideA(ctx)
|
||||
c.RunSideB(ctx)
|
||||
@ -293,7 +299,7 @@ func TestNewReno_Congestion(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
c := newNewRenoTest(rtt)
|
||||
c := newNewRenoTest(ctx, rtt)
|
||||
c.Start(ctx)
|
||||
c.RunSideA(ctx)
|
||||
c.RunSideB(ctx)
|
||||
|
Loading…
Reference in New Issue
Block a user