Skip to content

Commit

Permalink
do not create blockSizes man when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Sep 14, 2024
1 parent f6fcbd7 commit 235a39f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bitswap/server/internal/decision/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,14 @@ func (e *Engine) MessageReceived(ctx context.Context, p peer.ID, m bsmsg.BitSwap
log.Info("aborting message processing", err)
return false
}

Check warning on line 704 in bitswap/server/internal/decision/engine.go

View check run for this annotation

Codecov / codecov/patch

bitswap/server/internal/decision/engine.go#L702-L704

Added lines #L702 - L704 were not covered by tests
if blockSizes == nil {
blockSizes = make(map[cid.Cid]int, len(hasBlocks))
}
for blkCid := range hasBlocks {
blockSizes[blkCid] = 0
if len(hasBlocks) != 0 {
if blockSizes == nil {
blockSizes = make(map[cid.Cid]int, len(hasBlocks))
}
for blkCid := range hasBlocks {
blockSizes[blkCid] = 0
fmt.Println(" block cid:", blkCid)
}
}
}

Expand Down

0 comments on commit 235a39f

Please sign in to comment.