Skip to content

Commit

Permalink
pw_transfer: Fix when to write Chunk::PendingBytes
Browse files Browse the repository at this point in the history
Change-Id: Ie7ac64ef6ce5bfcade62fab93a7450e939a30727
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/98521
Commit-Queue: Carlos Chinchilla <cachinchilla@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Pigweed-Auto-Submit: Carlos Chinchilla <cachinchilla@google.com>
  • Loading branch information
ChinchillaWithGoggles authored and CQ Bot Account committed Jun 17, 2022
1 parent d7431f4 commit cf60b1c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pw_transfer/chunk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ Result<ConstByteSpan> Chunk::Encode(ByteSpan buffer) const {

// In the legacy protocol, the pending_bytes field must be set alongside
// window_end_offset, as some transfer implementations require it.
encoder.WritePendingBytes(window_end_offset_ - offset_).IgnoreError();
if (window_end_offset_ != 0) {
encoder.WritePendingBytes(window_end_offset_ - offset_).IgnoreError();
}
}

if (max_chunk_size_bytes_.has_value()) {
Expand Down

0 comments on commit cf60b1c

Please sign in to comment.