Skip to content

Commit

Permalink
try adding exact chunklength on last chunk, instead of using generic …
Browse files Browse the repository at this point in the history
…length. does this help?
  • Loading branch information
scbedd committed Feb 16, 2023
1 parent 6e2d8d5 commit dac75ec
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,9 @@ public byte[][] GetBatches(byte[] bodyData, int batchCount)

for(int i = 0; i < batches.Length; i++)
{
var batch = new byte[chunkLength];
Array.Copy(bodyData, i * chunkLength, batch, 0, i == batches.Length - 1 && batches.Length > 1 && remainder > 0 ? remainder : chunkLength);
var calculatedChunkLength = i == batches.Length - 1 && batches.Length > 1 && remainder > 0 ? remainder : chunkLength;
var batch = new byte[calculatedChunkLength];
Array.Copy(bodyData, i * chunkLength, batch, 0, calculatedChunkLength);

batches[i] = batch;
}
Expand All @@ -515,6 +516,10 @@ public async Task WriteBodyBytes(byte[] bodyData, int playbackResponseTime, Http
{
Thread.Sleep(sleepLength);
}
else
{
await outgoingResponse.Body.FlushAsync().ConfigureAwait(false);
}
}
}
else
Expand Down

0 comments on commit dac75ec

Please sign in to comment.