aboutsummaryrefslogtreecommitdiffstats
path: root/les/fetcher.go
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 /les/fetcher.go
parentff225db813b6d56ecd35db301bc582ca04e42b27 (diff)
downloaddexon-dfc5842a89781c22e847913f723d6b0a4e439479.tar.gz
dexon-dfc5842a89781c22e847913f723d6b0a4e439479.tar.zst
dexon-dfc5842a89781c22e847913f723d6b0a4e439479.zip
les: add missing lock around peer access
Diffstat (limited to 'les/fetcher.go')
-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
},