Hi,
I am writing a C++ future/promised based interface around the grpc c++ API. Some important details around termination of the streams are not clear to me, even after reading through discussions here and many open/closed issues in the GitHub repository. Suppose a client calls a SERVER_STREAMING RPC using ClientAsyncReader, ClientContext etc. Finish() Can only be called after cq.Next() returns ok = false for a Read() operation. So the normal sequence could look like: - Read(), ok =true - Read(), ok =true - Read(), ok =true - Read(), ok = true - Read(), ok = false // nothing more to read - Finish(), ok = true // gets RPC status - Delete ClientAsyncReader and ClientContext Now suppose the client throws an exception while processing the response returned by the second Read(). From what I understand I have to call ClientContext::TryCancel() and then keep calling Read() until ok = false, then call Finish(): - Read(), ok =true - Read(), ok =true, exception while applying business logic - ClientContext::TryCancel() - Read(), ok =true // could happen from what I understand - Read(), false = true - Finish(), ok = true - Delete ClientAsyncReader and ClientContext I have a strong feeling it's required to *always* call Finish() before releasing resources, but I have not found any doc/issue/discussion, which confirms it 100%. Is there any other alternative way to terminate the stream in an orderly fashion? Patrick -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b317d1ec-5789-494a-a3a1-babfcdccf763%40googlegroups.com.
