Skip to content

Commit

Permalink
pw_transfer: Fix offset receive transfer startup
Browse files Browse the repository at this point in the history
Receive offset transfer handshake sends a start ack conf that has no
offset, triggering the ignore previous data code path on processing.
This results in the parameters never being initiated so that data can be
sent. Exclude start ack conf packets from that error check.

Bugs: b/368620868
Change-Id: Icaa8632bbea861972d50b2365e2bde9322411e79
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/237095
Docs-Not-Needed: Jordan Brauer <jtbrauer@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Jordan Brauer <jtbrauer@google.com>
  • Loading branch information
Jordan Brauer authored and CQ Bot Account committed Sep 20, 2024
1 parent 2db0e0c commit da9a7e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pw_transfer/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,14 @@ void Context::HandleReceiveChunk(const Chunk& chunk) {

void Context::HandleReceivedData(const Chunk& chunk) {
if (chunk.offset() != offset_) {
if (chunk.offset() + chunk.payload().size() <= offset_) {
if (chunk.offset() + chunk.payload().size() <= offset_ &&
chunk.type() != Chunk::Type::kStartAckConfirmation) {
// If the chunk's data has already been received, don't go through a full
// recovery cycle to avoid shrinking the window size and potentially
// thrashing. The expected data may already be in-flight, so just allow
// the transmitter to keep going with a CONTINUE parameters chunk.
// Start ack confs do not come with an offset set, so it can get stuck
// here if we are doing an offset transfer.
PW_LOG_DEBUG("Transfer %u received duplicate chunk with offset %u",
id_for_log(),
static_cast<unsigned>(chunk.offset()));
Expand Down

0 comments on commit da9a7e7

Please sign in to comment.