mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: fixed nexClientPool balance iterator
This commit is contained in:
parent
ab4a4af71a
commit
be4fb5757a
2 changed files with 6 additions and 3 deletions
|
|
@ -187,8 +187,10 @@ func newClientPool(db ethdb.Database, minCap, freeClientCap uint64, clock mclock
|
||||||
var stop bool
|
var stop bool
|
||||||
l := len(ids)
|
l := len(ids)
|
||||||
if l == 1000 {
|
if l == 1000 {
|
||||||
stop = true
|
|
||||||
l--
|
l--
|
||||||
|
start = ids[l]
|
||||||
|
} else {
|
||||||
|
stop = true
|
||||||
}
|
}
|
||||||
for i := 0; i < l; i++ {
|
for i := 0; i < l; i++ {
|
||||||
pool.disconnectedBalances += pool.ndb.getOrNewPB(ids[i]).value
|
pool.disconnectedBalances += pool.ndb.getOrNewPB(ids[i]).value
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ func (s *LesServer) Start(srvr *p2p.Server) {
|
||||||
go s.capacityManagement()
|
go s.capacityManagement()
|
||||||
|
|
||||||
if srvr.DiscV5 != nil {
|
if srvr.DiscV5 != nil {
|
||||||
srvr.DiscV5.RegisterTalkHandler("les", s.handler.talkRequestHandler)
|
srvr.DiscV5.RegisterTalkHandler("lespay", s.handler.talkRequestHandler)
|
||||||
for _, topic := range s.lesTopics {
|
for _, topic := range s.lesTopics {
|
||||||
topic := topic
|
topic := topic
|
||||||
go func() {
|
go func() {
|
||||||
|
|
@ -195,8 +195,9 @@ func (s *LesServer) Stop() {
|
||||||
close(s.closeCh)
|
close(s.closeCh)
|
||||||
|
|
||||||
if s.srvr.DiscV5 != nil {
|
if s.srvr.DiscV5 != nil {
|
||||||
s.srvr.DiscV5.RemoveTalkHandler("les")
|
s.srvr.DiscV5.RemoveTalkHandler("lespay")
|
||||||
}
|
}
|
||||||
|
s.tokenSale.stop()
|
||||||
|
|
||||||
// Disconnect existing sessions.
|
// Disconnect existing sessions.
|
||||||
// This also closes the gate for any new registrations on the peer set.
|
// This also closes the gate for any new registrations on the peer set.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue