This prevents peers being banned when there are issues with the data service locally.
return
}
tr.Stop("write chunk")
+ me.mu.Lock()
+ if c.peerTouchedPieces == nil {
+ c.peerTouchedPieces = make(map[int]struct{})
+ }
+ c.peerTouchedPieces[int(req.Index)] = struct{}{}
+ me.mu.Unlock()
}()
- // This could be made dependent on whether any actual data was written.
- if c.peerTouchedPieces == nil {
- c.peerTouchedPieces = make(map[int]struct{})
- }
- c.peerTouchedPieces[int(req.Index)] = struct{}{}
// log.Println("got chunk", req)
me.event.Broadcast()