Skip to content

grpc: close stream with data frame#500

Merged
junr03 merged 6 commits intomasterfrom
grpc-close
Oct 15, 2019
Merged

grpc: close stream with data frame#500
junr03 merged 6 commits intomasterfrom
grpc-close

Conversation

@junr03
Copy link
Copy Markdown
Member

@junr03 junr03 commented Oct 14, 2019

Description: the gRPC protocol requires closing the client stream in a DATA frame. This PR fixes the GRPCStreamEmitter for iOS.
Risk Level: med - protocol level changes.
Testing: local.

Signed-off-by: Jose Nino jnino@lyft.com

Signed-off-by: Jose Nino <jnino@lyft.com>
@rebello95 rebello95 mentioned this pull request Oct 14, 2019
Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03
Copy link
Copy Markdown
Member Author

junr03 commented Oct 14, 2019

@buildbreaker @rebello95 I updated with @goaway's suggestion. lmk what you think

public func close(_ data: Data) {
// The gRPC protocol requires the client stream to close with a DATA frame.
// More information here: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests
self.underlyingEmitter.close()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is actually wrong, it'll still send trailers here rather than empty data.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How come? I thought by deleting the extension below, I was getting rid of a default value when no argument was given

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment was before the extension was deleted. I don't think this compiles as-is, you'll need to specify trailers: nil I believe

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

😂 I think my commit and your comment cross paths. Will update

Signed-off-by: Jose Nino <jnino@lyft.com>
@rebello95
Copy link
Copy Markdown
Contributor

Let's make the appropriate changes on Android as well as part of this PR

Signed-off-by: Jose Nino <jnino@lyft.com>
public func close() {
self.close(trailers: [:])
}
/// - parameter trailers: optional trailers to send over the stream.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: Trailers with which to close the stream. If nil, stream will be closed with an empty data frame.

@rebello95 rebello95 mentioned this pull request Oct 15, 2019
Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03 junr03 marked this pull request as ready for review October 15, 2019 17:16
rebello95
rebello95 previously approved these changes Oct 15, 2019
Signed-off-by: Jose Nino <jnino@lyft.com>
}

func close(trailers: [String: [String]]) {}
func close(trailers: [String: [String]]?) {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I’ll add a test for this in another PR

@junr03 junr03 merged commit cf8f2c8 into master Oct 15, 2019
@junr03 junr03 deleted the grpc-close branch October 15, 2019 21:07
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.

3 participants