les: UDP pre-negotiation of available server capacity (#22183)
This PR implements the first one of the "lespay" UDP queries which is already useful in itself: the capacity query. The server pool is making use of this query by doing a cheap UDP query to determine whether it is worth starting the more expensive TCP connection process.
This commit is contained in:
@@ -508,8 +508,10 @@ func TestNegativeBalanceCalculation(t *testing.T) {
|
||||
for i := 0; i < 10; i++ {
|
||||
pool.disconnect(newPoolTestPeer(i, nil))
|
||||
_, nb := getBalance(pool, newPoolTestPeer(i, nil))
|
||||
if checkDiff(nb, uint64(time.Minute)/1000) {
|
||||
t.Fatalf("Negative balance mismatch, want %v, got %v", uint64(time.Minute)/1000, nb)
|
||||
exp := uint64(time.Minute) / 1000
|
||||
exp -= exp / 120 // correct for negative balance expiration
|
||||
if checkDiff(nb, exp) {
|
||||
t.Fatalf("Negative balance mismatch, want %v, got %v", exp, nb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user