Commit 5d13ac37 authored by Steven Allen's avatar Steven Allen

fix: fix duplicate block issue in bitswap

1. Increase broadcast timeout.
2. Fix use of sessions when pinning.

This also includes some bitswap changes to reduce some memory allocations and
optimize some hot spots.
parent 8cb67abf
...@@ -65,6 +65,11 @@ func Pinning(bstore blockstore.Blockstore, ds format.DAGService, repo repo.Repo) ...@@ -65,6 +65,11 @@ func Pinning(bstore blockstore.Blockstore, ds format.DAGService, repo repo.Repo)
return pinning, nil return pinning, nil
} }
var (
_ merkledag.SessionMaker = new(syncDagService)
_ format.DAGService = new(syncDagService)
)
// syncDagService is used by the Pinner to ensure data gets persisted to the underlying datastore // syncDagService is used by the Pinner to ensure data gets persisted to the underlying datastore
type syncDagService struct { type syncDagService struct {
format.DAGService format.DAGService
...@@ -75,6 +80,10 @@ func (s *syncDagService) Sync() error { ...@@ -75,6 +80,10 @@ func (s *syncDagService) Sync() error {
return s.syncFn() return s.syncFn()
} }
func (s *syncDagService) Session(ctx context.Context) format.NodeGetter {
return merkledag.NewSession(ctx, s.DAGService)
}
// Dag creates new DAGService // Dag creates new DAGService
func Dag(bs blockservice.BlockService) format.DAGService { func Dag(bs blockservice.BlockService) format.DAGService {
return merkledag.NewDAGService(bs) return merkledag.NewDAGService(bs)
......
This diff is collapsed.
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