aboutsummaryrefslogtreecommitdiffstats
path: root/les
diff options
context:
space:
mode:
authorZsolt Felfoldi <zsfelfoldi@gmail.com>2017-01-26 09:52:59 +0800
committerZsolt Felfoldi <zsfelfoldi@gmail.com>2017-01-27 09:52:45 +0800
commita390ca5f30e871715f28937a02e87fff050b0c75 (patch)
tree9940f968f72ba14817f11a75b9dd172ea2d6f56e /les
parent12379c697aa72f4ce08733638e6f7e5dcdf3f94f (diff)
downloadgo-tangerine-a390ca5f30e871715f28937a02e87fff050b0c75.tar
go-tangerine-a390ca5f30e871715f28937a02e87fff050b0c75.tar.gz
go-tangerine-a390ca5f30e871715f28937a02e87fff050b0c75.tar.bz2
go-tangerine-a390ca5f30e871715f28937a02e87fff050b0c75.tar.lz
go-tangerine-a390ca5f30e871715f28937a02e87fff050b0c75.tar.xz
go-tangerine-a390ca5f30e871715f28937a02e87fff050b0c75.tar.zst
go-tangerine-a390ca5f30e871715f28937a02e87fff050b0c75.zip
les, cmd/util: disable topic discovery with --nodiscover
Diffstat (limited to 'les')
-rw-r--r--les/serverpool.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/les/serverpool.go b/les/serverpool.go
index 68e962c97..9735a718e 100644
--- a/les/serverpool.go
+++ b/les/serverpool.go
@@ -348,7 +348,9 @@ func (pool *serverPool) selectPeerWait(reqID uint64, canSend func(*peer) (bool,
func (pool *serverPool) eventLoop() {
lookupCnt := 0
var convTime mclock.AbsTime
- pool.discSetPeriod <- time.Millisecond * 100
+ if pool.discSetPeriod != nil {
+ pool.discSetPeriod <- time.Millisecond * 100
+ }
for {
select {
case entry := <-pool.timeout:
@@ -393,12 +395,16 @@ func (pool *serverPool) eventLoop() {
lookupCnt++
if pool.fastDiscover && (lookupCnt == 50 || time.Duration(mclock.Now()-convTime) > time.Minute) {
pool.fastDiscover = false
- pool.discSetPeriod <- time.Minute
+ if pool.discSetPeriod != nil {
+ pool.discSetPeriod <- time.Minute
+ }
}
}
case <-pool.quit:
- close(pool.discSetPeriod)
+ if pool.discSetPeriod != nil {
+ close(pool.discSetPeriod)
+ }
pool.connWg.Wait()
pool.saveNodes()
pool.wg.Done()