From aae56043cf9f4266db433947678e4577e7717b0d Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Wed, 18 Mar 2020 03:06:50 +0000 Subject: [PATCH] bug fix: lock the chunk map addresses #204 --- src/croc/croc.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/croc/croc.go b/src/croc/croc.go index 59fa364c..0c55392d 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -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 {