diff options
author | Alexei Frolov <frolv@google.com> | 2022-12-07 20:44:27 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-12-07 20:44:27 +0000 |
commit | 7485f3cd9d77eb7357192986e13b0badc9c74524 (patch) | |
tree | 54a7539b4e7d892fb749df29fe47856f8b2d03c3 /pw_transfer | |
parent | 7a426afcdbc7544a49d66d54bb6dc541a4760184 (diff) | |
download | pigweed-7485f3cd9d77eb7357192986e13b0badc9c74524.tar.gz |
pw_transfer: Fix handshake retransmission bug in Python client
The Python client would incorrectly resend a PARAMETERS_RETRANSMIT
chunk if its START_ACK_CONFIRMATION was dropped. This corrects that
behavior to retransmit the previously sent chunk.
Bug: 257308150
Change-Id: I67f26a10838d63a6bece2a75ebc4b573b4542c8d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/122972
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Diffstat (limited to 'pw_transfer')
-rw-r--r-- | pw_transfer/integration_test/cross_language_medium_read_test.py | 9 | ||||
-rw-r--r-- | pw_transfer/py/pw_transfer/transfer.py | 9 |
2 files changed, 7 insertions, 11 deletions
diff --git a/pw_transfer/integration_test/cross_language_medium_read_test.py b/pw_transfer/integration_test/cross_language_medium_read_test.py index 5d74d49e2..8899d8f78 100644 --- a/pw_transfer/integration_test/cross_language_medium_read_test.py +++ b/pw_transfer/integration_test/cross_language_medium_read_test.py @@ -118,15 +118,6 @@ class MediumTransferReadIntegrationTest(test_fixture.TransferIntegrationTest): @parameterized.expand(_ALL_LANGUAGES_AND_VERSIONS) def test_parameter_drop_client_read(self, client_type, protocol_version): """Drops the first few transfer initialization packets.""" - # TODO(b/257308150): Python v2 breaks and the transfer fails on this - # test. - if ( - client_type == "python" - and protocol_version == config_pb2.TransferAction.ProtocolVersion.V2 - ): - self.skipTest( - "This test fails when using v2 protocol with a Python client" - ) payload = random.Random(67336391945).randbytes(1234) config = TransferConfig( self.default_server_config(), diff --git a/pw_transfer/py/pw_transfer/transfer.py b/pw_transfer/py/pw_transfer/transfer.py index b6479081c..11dc55636 100644 --- a/pw_transfer/py/pw_transfer/transfer.py +++ b/pw_transfer/py/pw_transfer/transfer.py @@ -353,10 +353,15 @@ class Transfer(abc.ABC): self._max_retries, ) - if self._state in ( + retry_handshake_chunk = self._state in ( Transfer._State.INITIATING, Transfer._State.TERMINATING, - ): + ) or ( + self._last_chunk is not None + and self._last_chunk.type is Chunk.Type.START_ACK_CONFIRMATION + ) + + if retry_handshake_chunk: assert self._last_chunk is not None self._send_chunk(self._last_chunk) else: |