containerd / ttrpc-rust

Rust implementation of ttrpc (GRPC for low-memory environments)
Apache License 2.0
197 stars 47 forks source link

stream: Fix default data won't be received issue #208

Closed Tim-Zhang closed 1 year ago

Tim-Zhang commented 1 year ago

Protobuf encodes default values, e.g., 0 for number, "" for string, as empty payload and we wouldn't send empty payload to a receiver.

This commit change the method of empty message detecting.

Fixes #169 Fixes #207

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage has no change and project coverage change: -0.07% :warning:

Comparison is base (3ef0e4e) 24.42% compared to head (e16aa7b) 24.35%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #208 +/- ## ========================================== - Coverage 24.42% 24.35% -0.07% ========================================== Files 16 16 Lines 2645 2652 +7 ========================================== Hits 646 646 - Misses 1999 2006 +7 ``` | [Files Changed](https://app.codecov.io/gh/containerd/ttrpc-rust/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=containerd) | Coverage Δ | | |---|---|---| | [src/asynchronous/client.rs](https://app.codecov.io/gh/containerd/ttrpc-rust/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=containerd#diff-c3JjL2FzeW5jaHJvbm91cy9jbGllbnQucnM=) | `0.00% <0.00%> (ø)` | | | [src/asynchronous/server.rs](https://app.codecov.io/gh/containerd/ttrpc-rust/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=containerd#diff-c3JjL2FzeW5jaHJvbm91cy9zZXJ2ZXIucnM=) | `0.00% <0.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jsturtevant commented 1 year ago

would it be worth adding a message to the example that validates this? Sounds like it is pretty easy to replicate by passing 0's here https://github.com/containerd/ttrpc-rust/blob/555c412130e06d9c5632927e7bb7a1a4ed1ca774/example/async-stream-client.rs#L124-L125?

Tim-Zhang commented 1 year ago

@jsturtevant Good suggestion, I've just finished it and please help to review it again, thanks