les: make clientPool.connectedBias configurable (#21305)

This commit is contained in:
Binacs
2020-07-21 16:23:40 +08:00
committed by GitHub
parent 3a52c4dcf2
commit 4366c45e4e
3 changed files with 28 additions and 17 deletions

View File

@ -91,7 +91,7 @@ func testClientPool(t *testing.T, connLimit, clientCount, paidCount int, randomD
}
pool = newClientPool(db, 1, &clock, disconnFn)
)
pool.disableBias = true
pool.setConnectedBias(0)
pool.setLimits(connLimit, uint64(connLimit))
pool.setDefaultFactors(priceFactors{1, 0, 1}, priceFactors{1, 0, 1})
@ -248,7 +248,7 @@ func TestPaidClientKickedOut(t *testing.T) {
clock.Run(time.Millisecond)
}
clock.Run(time.Second)
clock.Run(connectedBias)
clock.Run(defaultConnectedBias)
if !pool.connect(poolTestPeer(11), 0) {
t.Fatalf("Free client should be accectped")
}