- Allow zero-sized requests since they are sent by all current versions of Syncthing. - Stop sending zero-sized requests since that's stupid. --------- Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
@@ -1345,6 +1345,12 @@ func (f *sendReceiveFolder) copierRoutine(ctx context.Context, in <-chan copyBlo
|
||||
default:
|
||||
}
|
||||
|
||||
if block.Size == 0 {
|
||||
// Copying zero bytes is a no-op.
|
||||
state.copyDone(block)
|
||||
continue
|
||||
}
|
||||
|
||||
if !f.DisableSparseFiles && state.reused == 0 && block.IsEmpty() {
|
||||
// The block is a block of all zeroes, and we are not reusing
|
||||
// a temp file, so there is no need to do anything with it.
|
||||
@@ -1534,6 +1540,13 @@ func (f *sendReceiveFolder) pullerRoutine(ctx context.Context, in <-chan pullBlo
|
||||
|
||||
bytes := state.block.Size
|
||||
|
||||
if bytes == 0 {
|
||||
// Pulling zero bytes is a no-op.
|
||||
state.pullDone(state.block)
|
||||
out <- state.sharedPullerState
|
||||
continue
|
||||
}
|
||||
|
||||
if err := requestLimiter.TakeWithContext(ctx, bytes); err != nil {
|
||||
state.fail(err)
|
||||
out <- state.sharedPullerState
|
||||
|
||||
Reference in New Issue
Block a user