aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-02-15 03:09:20 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-02-15 03:09:20 +0800
commitdfc5842a89781c22e847913f723d6b0a4e439479 (patch)
tree57c1dca59fe65666e5353396211645ba48de86fd
parentff225db813b6d56ecd35db301bc582ca04e42b27 (diff)
downloadgo-tangerine-dfc5842a89781c22e847913f723d6b0a4e439479.tar
go-tangerine-dfc5842a89781c22e847913f723d6b0a4e439479.tar.gz
go-tangerine-dfc5842a89781c22e847913f723d6b0a4e439479.tar.bz2
go-tangerine-dfc5842a89781c22e847913f723d6b0a4e439479.tar.lz
go-tangerine-dfc5842a89781c22e847913f723d6b0a4e439479.tar.xz
go-tangerine-dfc5842a89781c22e847913f723d6b0a4e439479.tar.zst
go-tangerine-dfc5842a89781c22e847913f723d6b0a4e439479.zip
les: add missing lock around peer access
-rw-r--r--les/fetcher.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/les/fetcher.go b/les/fetcher.go
index 3fc4df30b..9d224176f 100644
--- a/les/fetcher.go
+++ b/les/fetcher.go
@@ -425,6 +425,9 @@ func (f *lightFetcher) nextRequest() (*distReq, uint64) {
},
canSend: func(dp distPeer) bool {
p := dp.(*peer)
+ f.lock.Lock()
+ defer f.lock.Unlock()
+
fp := f.peers[p]
return fp != nil && fp.nodeByHash[bestHash] != nil
},