pw_transfer: Retry on write transfer timeouts

- Rather than relying on the server to timeout and send transfer
  parameters when there are drops, resend the last packet of the window.
- Check if the transfer is complete in the timeout callback. Previously,
  because asyncio task cancellation is unreliable, completed transfers
  would sometimes time out, resulting in KeyErrors when they delete
  themselves from the transfer dict.
- Refactor to share more code between read and write transfers. Move
  timeout and retry logic to the base Transfer class.
- Expose the Manager and Error classes as pw_transfer.Manager and
  pw_transfer.Error.

Change-Id: Iea680ad6d311fd7dd91ad74d187eecb1b6c5d0b9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/62821
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Joe Ethier <jethier@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
4 files changed
tree: 97f97393bcd2ed6204cfa01cd1401254731b5e5d
  1. build_overrides/
  2. docker/
  3. docs/
  4. pw_allocator/
  5. pw_analog/
  6. pw_android_toolchain/
  7. pw_arduino_build/
  8. pw_assert/
  9. pw_assert_basic/
  10. pw_assert_log/
  11. pw_base64/
  12. pw_bloat/
  13. pw_blob_store/
  14. pw_bluetooth_hci/
  15. pw_boot/
  16. pw_boot_cortex_m/
  17. pw_build/
  18. pw_build_info/
  19. pw_bytes/
  20. pw_checksum/
  21. pw_chrono/
  22. pw_chrono_embos/
  23. pw_chrono_freertos/
  24. pw_chrono_stl/
  25. pw_chrono_threadx/
  26. pw_cli/
  27. pw_console/
  28. pw_containers/
  29. pw_cpu_exception/
  30. pw_cpu_exception_cortex_m/
  31. pw_crypto/
  32. pw_docgen/
  33. pw_doctor/
  34. pw_env_setup/
  35. pw_file/
  36. pw_function/
  37. pw_fuzzer/
  38. pw_hdlc/
  39. pw_hex_dump/
  40. pw_i2c/
  41. pw_interrupt/
  42. pw_interrupt_cortex_m/
  43. pw_kvs/
  44. pw_libc/
  45. pw_log/
  46. pw_log_basic/
  47. pw_log_null/
  48. pw_log_rpc/
  49. pw_log_tokenized/
  50. pw_malloc/
  51. pw_malloc_freelist/
  52. pw_metric/
  53. pw_minimal_cpp_stdlib/
  54. pw_module/
  55. pw_multisink/
  56. pw_package/
  57. pw_persistent_ram/
  58. pw_polyfill/
  59. pw_preprocessor/
  60. pw_presubmit/
  61. pw_protobuf/
  62. pw_protobuf_compiler/
  63. pw_random/
  64. pw_result/
  65. pw_ring_buffer/
  66. pw_router/
  67. pw_rpc/
  68. pw_snapshot/
  69. pw_software_update/
  70. pw_span/
  71. pw_status/
  72. pw_stm32cube_build/
  73. pw_stream/
  74. pw_string/
  75. pw_symbolizer/
  76. pw_sync/
  77. pw_sync_baremetal/
  78. pw_sync_embos/
  79. pw_sync_freertos/
  80. pw_sync_stl/
  81. pw_sync_threadx/
  82. pw_sys_io/
  83. pw_sys_io_arduino/
  84. pw_sys_io_baremetal_lm3s6965evb/
  85. pw_sys_io_baremetal_stm32f429/
  86. pw_sys_io_stdio/
  87. pw_target_runner/
  88. pw_thread/
  89. pw_thread_embos/
  90. pw_thread_freertos/
  91. pw_thread_stl/
  92. pw_thread_threadx/
  93. pw_tls_client/
  94. pw_tls_client_boringssl/
  95. pw_tls_client_mbedtls/
  96. pw_tokenizer/
  97. pw_tool/
  98. pw_toolchain/
  99. pw_trace/
  100. pw_trace_tokenized/
  101. pw_transfer/
  102. pw_unit_test/
  103. pw_varint/
  104. pw_watch/
  105. pw_web_ui/
  106. pw_work_queue/
  107. targets/
  108. third_party/
  109. .bazelignore
  110. .bazelrc
  111. .clang-format
  112. .clang-tidy
  113. .eslintrc.json
  114. .gitattributes
  115. .gitignore
  116. .gn
  117. .prettierrc.js
  118. .pylintrc
  119. activate.bat
  120. AUTHORS
  121. bootstrap.bat
  122. bootstrap.sh
  123. BUILD.bazel
  124. BUILD.gn
  125. BUILDCONFIG.gn
  126. CMakeLists.txt
  127. LICENSE
  128. modules.gni
  129. OWNERS
  130. package.json
  131. PW_PLUGINS
  132. README.md
  133. tsconfig.json
  134. WORKSPACE
  135. yarn.lock
README.md

See our website: http://pigweed.dev