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

Enforce request cardinality for unary-request calls also for the case of zero request messages being sent. #392

Merged
merged 7 commits into from
Mar 6, 2019

Conversation

MrMage
Copy link
Collaborator

@MrMage MrMage commented Mar 5, 2019

Otherwise, the server will never respond to a call that gets closed without the client sending a response.

In addition, we introduce a method sendErrorStatus (happy to discuss naming) on BaseCallHandler that sends an error status to the client while ensuring that all call context promises are fulfilled. This method is required (and needs to be overridden) because only the concrete call subclass knows which promises need to be fulfilled.

… of zero request messages being sent.

Otherwise, the server will never respond to a call that gets closed without the client sending a response.
@MrMage MrMage requested a review from rebello95 March 5, 2019 10:43
@MrMage
Copy link
Collaborator Author

MrMage commented Mar 5, 2019

/cc @glbrntt for review (can't request a review for you through the GitHub "Reviewers" list for some reason)

…- it's easier to test this via HTTP1 than having to set up an HTTP2 client.
@MrMage
Copy link
Collaborator Author

MrMage commented Mar 5, 2019

@glbrntt I've slightly extended the scope of this PR; please take another look.

Sources/SwiftGRPCNIO/CallHandlers/BaseCallHandler.swift Outdated Show resolved Hide resolved
Sources/SwiftGRPCNIO/GRPCError.swift Show resolved Hide resolved

private func gRPCWebOKTrailers() -> Data {
var data = "grpc-status: 0\r\ngrpc-message: OK".data(using: .utf8)!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Revert

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like there's still trailing whitespace here

Tests/SwiftGRPCNIOTests/NIOServerWebTests.swift Outdated Show resolved Hide resolved
@MrMage MrMage requested a review from rebello95 March 5, 2019 19:42
@MrMage
Copy link
Collaborator Author

MrMage commented Mar 5, 2019

@rebello95 please take another look, especially at the unresolved conversations. Feel free to squash-and-merge if you are satisfied with the current revision.


private func gRPCWebOKTrailers() -> Data {
var data = "grpc-status: 0\r\ngrpc-message: OK".data(using: .utf8)!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like there's still trailing whitespace here

Tests/SwiftGRPCNIOTests/NIOServerWebTests.swift Outdated Show resolved Hide resolved
@MrMage
Copy link
Collaborator Author

MrMage commented Mar 6, 2019

Looks like I forgot to actually commit and push my fixes, sorry about that! @rebello95, please take one final look.

@rebello95 rebello95 merged commit d4a6366 into master Mar 6, 2019
@MrMage MrMage deleted the zero-requests branch April 4, 2019 11:18
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