Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 18, 2023

Conversation

Tim-Zhang
Copy link
Member

@Tim-Zhang Tim-Zhang commented Aug 9, 2023

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

@Tim-Zhang Tim-Zhang requested a review from wllenyj August 9, 2023 13:31
@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.07% ⚠️

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
@@            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 Coverage Δ
src/asynchronous/client.rs 0.00% <0.00%> (ø)
src/asynchronous/server.rs 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jsturtevant
Copy link
Collaborator

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

sum: 392,
num: 4,
?

Tim-Zhang added a commit to Tim-Zhang/ttrpc-rust that referenced this pull request Aug 10, 2023
@Tim-Zhang
Copy link
Member Author

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

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 containerd#169
Fixes containerd#207

Signed-off-by: Tim Zhang <[email protected]>
Tim-Zhang added a commit to Tim-Zhang/ttrpc-rust that referenced this pull request Aug 10, 2023
Copy link
Collaborator

@jsturtevant jsturtevant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@wllenyj wllenyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

Copy link

@studychao studychao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but only one small nit

@@ -120,12 +120,17 @@ async fn sum_stream(cli: streaming_ttrpc::StreamingClient) {

#[cfg(unix)]
async fn divide_stream(cli: streaming_ttrpc::StreamingClient) {
let mut stream = cli

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could we create a test case to test the default value specifically instead of messing it into divide_stream?

Copy link
Member Author

@Tim-Zhang Tim-Zhang Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new case was added instead of modifying one of the exists.

@lifupan lifupan merged commit 842864d into containerd:master Aug 18, 2023
11 of 13 checks passed
@Tim-Zhang Tim-Zhang deleted the fix-stream-recv-default-data branch August 21, 2023 01:47
Tim-Zhang added a commit to Tim-Zhang/ttrpc-rust that referenced this pull request Aug 22, 2023
@Tim-Zhang Tim-Zhang mentioned this pull request Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connection lost when sending i32 with value 0 in stream ttrpc Empty Proto Hangs Server Streaming RPC
5 participants