bug fix: lock the chunk map

addresses #204
This commit is contained in:
Zack Scholl 2020-03-18 03:06:50 +00:00
parent 09d35d248f
commit aae56043cf
1 changed files with 2 additions and 0 deletions

View File

@ -775,10 +775,12 @@ func (c *Client) processMessage(payload []byte) (done bool, err error) {
c.CurrentFileChunkRanges = remoteFile.CurrentFileChunkRanges
c.CurrentFileChunks = utils.ChunkRangesToChunks(c.CurrentFileChunkRanges)
log.Debugf("current file chunks: %+v", c.CurrentFileChunks)
c.mutex.Lock()
c.chunkMap = make(map[uint64]struct{})
for _, chunk := range c.CurrentFileChunks {
c.chunkMap[uint64(chunk)] = struct{}{}
}
c.mutex.Unlock()
c.Step3RecipientRequestFile = true
if c.Options.Ask {