les: add missing lock around peer access

This commit is contained in:
Péter Szilágyi 2018-02-14 21:09:20 +02:00
parent ff225db813
commit dfc5842a89
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
1 changed files with 3 additions and 0 deletions

View File

@ -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
},