Commit e3743a4d authored by acud's avatar acud Committed by GitHub

fix pullsync panic on unprotected read from map (#381)

parent f1a6def3
......@@ -403,12 +403,13 @@ func (s *Syncer) cancelHandler(ctx context.Context, p p2p.Peer, stream p2p.Strea
return fmt.Errorf("read cancel: %w", err)
}
s.ruidMtx.Lock()
defer s.ruidMtx.Unlock()
if cancel, ok := s.ruidCtx[c.Ruid]; ok {
cancel()
}
s.ruidMtx.Lock()
delete(s.ruidCtx, c.Ruid)
s.ruidMtx.Unlock()
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment