Skip to content

Commit

Permalink
Do not remove the block until AFTER the next() call so that handler c…
Browse files Browse the repository at this point in the history
…an access the Block2 option. This allows the handle to keep track of the transfer. For example, keeping track of Block X of Y, or report status every 50 blocks, or on last block signal a completion event
  • Loading branch information
krbvroc1 authored and jkralik committed Jun 27, 2024
1 parent ff2c47d commit 700909c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/blockwise/blockwise.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ func (b *BlockWise[C]) handleReceivedMessage(w *responsewriter.ResponseWriter[C]
case codes.GET, codes.DELETE:
maxSZX = fitSZX(r, message.Block2, maxSZX)
block, errG := r.GetOptionUint32(message.Block2)
next(w, r)
if errG == nil {
r.Remove(message.Block2)
}
next(w, r)
if w.Message().Code() == codes.Content && errG == nil {
startSendingMessageBlock = block
}
Expand Down

0 comments on commit 700909c

Please sign in to comment.