pw_transfer: Use correct chunk ID when resource doesn't exist

In transfer protocol v2, session IDs are assigned by the server. When a
client sends its opening chunk, it does not yet know its session ID and
expects a response that is identified by the resource ID it is trying to
transfer.

In response to an opening chunk from the client, the server looks up a
handler for the requested resource. If one is not found, the transfer
thread responds directly without assigning a context for the transfer.
This direct response did not account for the initial session/resource ID
discrepancy, instead sending its NOT_FOUND chunk with the newly assigned
session ID of which the client had no knowledge.

This updates the transfer thread to always use resource ID to identify
an error in response to an opening chunk. In legacy protocol, the two
are the same, whereas in v2, resource ID is expected.

Bug: 252870476
Change-Id: Ia594286976e263b6a46cf0bc582a848122386471
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/113990
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2 files changed
tree: 8d7b71ebf65f3bd535fe0fc804ef74257e168866
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. pw_allocator/
  7. pw_analog/
  8. pw_android_toolchain/
  9. pw_arduino_build/
  10. pw_assert/
  11. pw_assert_basic/
  12. pw_assert_log/
  13. pw_assert_tokenized/
  14. pw_assert_zephyr/
  15. pw_base64/
  16. pw_bloat/
  17. pw_blob_store/
  18. pw_bluetooth/
  19. pw_bluetooth_hci/
  20. pw_boot/
  21. pw_boot_cortex_m/
  22. pw_build/
  23. pw_build_info/
  24. pw_build_mcuxpresso/
  25. pw_bytes/
  26. pw_checksum/
  27. pw_chrono/
  28. pw_chrono_embos/
  29. pw_chrono_freertos/
  30. pw_chrono_stl/
  31. pw_chrono_threadx/
  32. pw_chrono_zephyr/
  33. pw_cli/
  34. pw_compilation_testing/
  35. pw_console/
  36. pw_containers/
  37. pw_cpu_exception/
  38. pw_cpu_exception_cortex_m/
  39. pw_crypto/
  40. pw_digital_io/
  41. pw_docgen/
  42. pw_doctor/
  43. pw_env_setup/
  44. pw_file/
  45. pw_function/
  46. pw_fuzzer/
  47. pw_hdlc/
  48. pw_hex_dump/
  49. pw_i2c/
  50. pw_i2c_mcuxpresso/
  51. pw_ide/
  52. pw_interrupt/
  53. pw_interrupt_cortex_m/
  54. pw_interrupt_zephyr/
  55. pw_kvs/
  56. pw_libc/
  57. pw_log/
  58. pw_log_android/
  59. pw_log_basic/
  60. pw_log_null/
  61. pw_log_rpc/
  62. pw_log_string/
  63. pw_log_tokenized/
  64. pw_log_zephyr/
  65. pw_malloc/
  66. pw_malloc_freelist/
  67. pw_metric/
  68. pw_minimal_cpp_stdlib/
  69. pw_module/
  70. pw_multisink/
  71. pw_package/
  72. pw_perf_test/
  73. pw_persistent_ram/
  74. pw_polyfill/
  75. pw_preprocessor/
  76. pw_presubmit/
  77. pw_protobuf/
  78. pw_protobuf_compiler/
  79. pw_random/
  80. pw_result/
  81. pw_ring_buffer/
  82. pw_router/
  83. pw_rpc/
  84. pw_rust/
  85. pw_snapshot/
  86. pw_software_update/
  87. pw_span/
  88. pw_spi/
  89. pw_status/
  90. pw_stm32cube_build/
  91. pw_stream/
  92. pw_string/
  93. pw_symbolizer/
  94. pw_sync/
  95. pw_sync_baremetal/
  96. pw_sync_embos/
  97. pw_sync_freertos/
  98. pw_sync_stl/
  99. pw_sync_threadx/
  100. pw_sync_zephyr/
  101. pw_sys_io/
  102. pw_sys_io_arduino/
  103. pw_sys_io_baremetal_lm3s6965evb/
  104. pw_sys_io_baremetal_stm32f429/
  105. pw_sys_io_emcraft_sf2/
  106. pw_sys_io_mcuxpresso/
  107. pw_sys_io_stdio/
  108. pw_sys_io_stm32cube/
  109. pw_sys_io_zephyr/
  110. pw_system/
  111. pw_target_runner/
  112. pw_thread/
  113. pw_thread_embos/
  114. pw_thread_freertos/
  115. pw_thread_stl/
  116. pw_thread_threadx/
  117. pw_tls_client/
  118. pw_tls_client_boringssl/
  119. pw_tls_client_mbedtls/
  120. pw_tokenizer/
  121. pw_tool/
  122. pw_toolchain/
  123. pw_trace/
  124. pw_trace_tokenized/
  125. pw_transfer/
  126. pw_unit_test/
  127. pw_varint/
  128. pw_watch/
  129. pw_web/
  130. pw_work_queue/
  131. targets/
  132. third_party/
  133. ts/
  134. zephyr/
  135. .bazelignore
  136. .bazelrc
  137. .clang-format
  138. .clang-tidy
  139. .eslintrc.json
  140. .gitattributes
  141. .gitignore
  142. .gn
  143. .prettierrc.js
  144. .pw_ide.yaml
  145. .pylintrc
  146. activate.bat
  147. Android.bp
  148. AUTHORS
  149. bootstrap.bat
  150. bootstrap.sh
  151. BUILD.bazel
  152. BUILD.gn
  153. BUILDCONFIG.gn
  154. CMakeLists.txt
  155. jest.config.ts
  156. Kconfig.zephyr
  157. LICENSE
  158. modules.gni
  159. OWNERS
  160. package-lock.json
  161. package.json
  162. PIGWEED_MODULES
  163. PW_PLUGINS
  164. README.md
  165. rollup.config.js
  166. tsconfig.json
  167. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links