pw_rpc_transport: Don't write empty header in StreamRpcFrameSender

This commit slightly adjusts the behavior of StreamRpcFrameSender to
avoid making a Write call for an empty RpcFrame header. This is a
performance optimization, because some underlying streams might not
treat a write of 0 as a no-op. With the common case of Hdlc framing, the
header will always be empty.

Tested: After this change, StreamRpcFrameSender with Hdlc framing
Tested: no longer makes an empty write for each RpcFrame.
Change-Id: Ic6d5589495d8c9c185993fd0c59e92b57876fe3e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/220211
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Commit-Queue: Eli Lipsitz <elipsitz@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Austin Foxley <afoxley@google.com>
1 file changed
tree: 29c03afad1f7b0f3f6168808edf31fd62de73267
  1. .allstar/
  2. .github/
  3. .vscode/
  4. build_overrides/
  5. docker/
  6. docs/
  7. kudzu/
  8. pw_alignment/
  9. pw_allocator/
  10. pw_analog/
  11. pw_android_toolchain/
  12. pw_arduino_build/
  13. pw_assert/
  14. pw_assert_basic/
  15. pw_assert_log/
  16. pw_assert_tokenized/
  17. pw_assert_trap/
  18. pw_assert_zephyr/
  19. pw_async/
  20. pw_async2/
  21. pw_async2_basic/
  22. pw_async2_epoll/
  23. pw_async_basic/
  24. pw_base64/
  25. pw_bloat/
  26. pw_blob_store/
  27. pw_bluetooth/
  28. pw_bluetooth_hci/
  29. pw_bluetooth_profiles/
  30. pw_bluetooth_proxy/
  31. pw_bluetooth_sapphire/
  32. pw_boot/
  33. pw_boot_cortex_m/
  34. pw_build/
  35. pw_build_android/
  36. pw_build_info/
  37. pw_build_mcuxpresso/
  38. pw_bytes/
  39. pw_channel/
  40. pw_checksum/
  41. pw_chre/
  42. pw_chrono/
  43. pw_chrono_embos/
  44. pw_chrono_freertos/
  45. pw_chrono_rp2040/
  46. pw_chrono_stl/
  47. pw_chrono_threadx/
  48. pw_chrono_zephyr/
  49. pw_cli/
  50. pw_clock_tree/
  51. pw_clock_tree_mcuxpresso/
  52. pw_compilation_testing/
  53. pw_config_loader/
  54. pw_console/
  55. pw_containers/
  56. pw_cpu_exception/
  57. pw_cpu_exception_cortex_m/
  58. pw_cpu_exception_risc_v/
  59. pw_crypto/
  60. pw_digital_io/
  61. pw_digital_io_linux/
  62. pw_digital_io_mcuxpresso/
  63. pw_digital_io_rp2040/
  64. pw_dma_mcuxpresso/
  65. pw_docgen/
  66. pw_doctor/
  67. pw_emu/
  68. pw_env_setup/
  69. pw_env_setup_zephyr/
  70. pw_file/
  71. pw_format/
  72. pw_function/
  73. pw_fuzzer/
  74. pw_grpc/
  75. pw_hdlc/
  76. pw_hex_dump/
  77. pw_i2c/
  78. pw_i2c_linux/
  79. pw_i2c_mcuxpresso/
  80. pw_i2c_rp2040/
  81. pw_ide/
  82. pw_interrupt/
  83. pw_interrupt_cortex_m/
  84. pw_interrupt_xtensa/
  85. pw_interrupt_zephyr/
  86. pw_intrusive_ptr/
  87. pw_json/
  88. pw_kvs/
  89. pw_libc/
  90. pw_libcxx/
  91. pw_log/
  92. pw_log_android/
  93. pw_log_basic/
  94. pw_log_null/
  95. pw_log_rpc/
  96. pw_log_string/
  97. pw_log_tokenized/
  98. pw_log_zephyr/
  99. pw_malloc/
  100. pw_malloc_freelist/
  101. pw_malloc_freertos/
  102. pw_metric/
  103. pw_minimal_cpp_stdlib/
  104. pw_module/
  105. pw_multibuf/
  106. pw_multisink/
  107. pw_package/
  108. pw_perf_test/
  109. pw_persistent_ram/
  110. pw_polyfill/
  111. pw_preprocessor/
  112. pw_presubmit/
  113. pw_protobuf/
  114. pw_protobuf_compiler/
  115. pw_random/
  116. pw_result/
  117. pw_ring_buffer/
  118. pw_router/
  119. pw_rpc/
  120. pw_rpc_transport/
  121. pw_rust/
  122. pw_sensor/
  123. pw_snapshot/
  124. pw_software_update/
  125. pw_span/
  126. pw_spi/
  127. pw_spi_linux/
  128. pw_spi_mcuxpresso/
  129. pw_spi_rp2040/
  130. pw_status/
  131. pw_stm32cube_build/
  132. pw_stream/
  133. pw_stream_shmem_mcuxpresso/
  134. pw_stream_uart_linux/
  135. pw_stream_uart_mcuxpresso/
  136. pw_string/
  137. pw_symbolizer/
  138. pw_sync/
  139. pw_sync_baremetal/
  140. pw_sync_embos/
  141. pw_sync_freertos/
  142. pw_sync_stl/
  143. pw_sync_threadx/
  144. pw_sync_zephyr/
  145. pw_sys_io/
  146. pw_sys_io_ambiq_sdk/
  147. pw_sys_io_arduino/
  148. pw_sys_io_baremetal_lm3s6965evb/
  149. pw_sys_io_baremetal_stm32f429/
  150. pw_sys_io_emcraft_sf2/
  151. pw_sys_io_mcuxpresso/
  152. pw_sys_io_rp2040/
  153. pw_sys_io_stdio/
  154. pw_sys_io_stm32cube/
  155. pw_sys_io_zephyr/
  156. pw_system/
  157. pw_target_runner/
  158. pw_thread/
  159. pw_thread_embos/
  160. pw_thread_freertos/
  161. pw_thread_stl/
  162. pw_thread_threadx/
  163. pw_thread_zephyr/
  164. pw_tls_client/
  165. pw_tls_client_boringssl/
  166. pw_tls_client_mbedtls/
  167. pw_tokenizer/
  168. pw_toolchain/
  169. pw_toolchain_bazel/
  170. pw_trace/
  171. pw_trace_tokenized/
  172. pw_transfer/
  173. pw_uart/
  174. pw_unit_test/
  175. pw_unit_test_zephyr/
  176. pw_varint/
  177. pw_watch/
  178. pw_web/
  179. pw_work_queue/
  180. seed/
  181. targets/
  182. third_party/
  183. ts/
  184. zephyr/
  185. .bazelignore
  186. .bazelrc
  187. .bazelversion
  188. .black.toml
  189. .clang-format
  190. .clang-tidy
  191. .eslintrc.cjs
  192. .git-blame-ignore-revs
  193. .gitattributes
  194. .gitignore
  195. .gn
  196. .mypy.ini
  197. .prettierignore
  198. .prettierrc.cjs
  199. .pw_ide.yaml
  200. .pylintrc
  201. activate.bat
  202. Android.bp
  203. AUTHORS
  204. bootstrap.bat
  205. bootstrap.fish
  206. bootstrap.sh
  207. BUILD.bazel
  208. BUILD.gn
  209. BUILDCONFIG.gn
  210. CMakeLists.txt
  211. jest.config.ts
  212. Kconfig.zephyr
  213. LICENSE
  214. modules.gni
  215. OWNERS
  216. package-lock.json
  217. package.json
  218. pigweed.json
  219. PIGWEED_MODULES
  220. README.md
  221. rollup.config.js
  222. tsconfig.json
  223. WORKSPACE
  224. WORKSPACE_OWNERS
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