mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: fixed tests
This commit is contained in:
parent
5a8320b1eb
commit
83f8c12a3a
1 changed files with 7 additions and 6 deletions
|
|
@ -251,11 +251,16 @@ func (f *clientPool) connect(peer clientPeer, capacity uint64) bool {
|
||||||
}
|
}
|
||||||
// If the client is a free client, assign with a low free capacity,
|
// If the client is a free client, assign with a low free capacity,
|
||||||
// Otherwise assign with the given value(priority client)
|
// Otherwise assign with the given value(priority client)
|
||||||
if !e.priority {
|
if !e.priority || capacity == 0 {
|
||||||
capacity = f.freeClientCap
|
capacity = f.freeClientCap
|
||||||
}
|
}
|
||||||
e.capacity = capacity
|
e.capacity = capacity
|
||||||
|
|
||||||
|
// Starts a balance tracker
|
||||||
|
e.balanceTracker.init(f.clock, capacity)
|
||||||
|
e.balanceTracker.setBalance(posBalance, negBalance)
|
||||||
|
e.updatePriceFactors()
|
||||||
|
|
||||||
// If the number of clients already connected in the clientpool exceeds its
|
// If the number of clients already connected in the clientpool exceeds its
|
||||||
// capacity, evict some clients with lowest priority.
|
// capacity, evict some clients with lowest priority.
|
||||||
//
|
//
|
||||||
|
|
@ -293,16 +298,12 @@ func (f *clientPool) connect(peer clientPeer, capacity uint64) bool {
|
||||||
f.dropClient(c, now, true)
|
f.dropClient(c, now, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register new client to connection queue.
|
// Register new client to connection queue.
|
||||||
f.connectedMap[id] = e
|
f.connectedMap[id] = e
|
||||||
f.connectedQueue.Push(e)
|
f.connectedQueue.Push(e)
|
||||||
f.connectedCap += e.capacity
|
f.connectedCap += e.capacity
|
||||||
|
|
||||||
// Starts a balance tracker
|
|
||||||
e.balanceTracker.init(f.clock, capacity)
|
|
||||||
e.balanceTracker.setBalance(posBalance, negBalance)
|
|
||||||
e.updatePriceFactors()
|
|
||||||
|
|
||||||
// If the current client is a paid client, monitor the status of client,
|
// If the current client is a paid client, monitor the status of client,
|
||||||
// downgrade it to normal client if positive balance is used up.
|
// downgrade it to normal client if positive balance is used up.
|
||||||
if e.priority {
|
if e.priority {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue