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

Cancel a server side streaming call from client side in c++ #17292

Closed
lucifercr07 opened this issue Nov 26, 2018 · 3 comments
Closed

Cancel a server side streaming call from client side in c++ #17292

lucifercr07 opened this issue Nov 26, 2018 · 3 comments

Comments

@lucifercr07
Copy link

What version of gRPC and what language are you using?

v1.12, C++

What operating system (Linux, Windows, …) and version?

Ubuntu16.04

What runtime / compiler are you using (e.g. python version or version of gcc)

gcc6

What did you do?

I have a server side streaming call of sort rpc ListFeatures(Rectangle) returns (stream Feature) {}. How can I cancel the stream from client side or close the channel cleanly?

I have tried context.TryCancel() it does the job, but is it the correct way to close a channel or cancel the stream?

@kalman5
Copy link

kalman5 commented Nov 26, 2018

What happens if you close the ClientReader on the client side, at that point on the server side the ServerWriter::Write should start to return false

@lucifercr07
Copy link
Author

@kalman5 are you referring to ClientReader Finish() ?

@yashykt
Copy link
Member

yashykt commented Feb 5, 2019

Yes TryCancel() from the client should do the job. That is the right way to cancel a stream.

@yashykt yashykt closed this as completed Feb 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants