Skip to content

Commit

Permalink
bug fix: lock the chunk map
Browse files Browse the repository at this point in the history
addresses #204
  • Loading branch information
schollz committed Mar 18, 2020
1 parent 09d35d2 commit aae5604
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/croc/croc.go
Expand Up @@ -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 {
Expand Down

0 comments on commit aae5604

Please sign in to comment.