Re: [grpc-io] Closing a stream with a long living context

2017-02-06 Thread Josh Humphries
On Mon, Feb 6, 2017 at 1:49 PM, Michael Bond wrote: > This is a unary to stream, not stream to stream rpc, if that changes > anything. > Do you mean server-streaming (e.g. unary request message, streaming response)? If that is the case, calling stream.CloseSend() has no

Re: [grpc-io] Closing a stream with a long living context

2017-02-06 Thread Michael Bond
This is a unary to stream, not stream to stream rpc, if that changes anything. So would calling CloseSend() send a message to the python server? Then would I just need to handle said message to make sure the callbacks are executed? Basic flow: Go client opens stream to python server with args

Re: [grpc-io] Closing a stream with a long living context

2017-02-06 Thread Josh Humphries
On Mon, Feb 6, 2017 at 1:19 PM, Michael Bond wrote: > Thanks for the quick reply. Should of specified that the code in the > original post is a snippet, there's receiving logic underneath it. > > Some more details surrounding this. In this case I have a callback >

Re: [grpc-io] Closing a stream with a long living context

2017-02-06 Thread Michael Bond
Thanks for the quick reply. Should of specified that the code in the original post is a snippet, there's receiving logic underneath it. Some more details surrounding this. In this case I have a callback function on the server (written in python) that needs to be executed to free resources, so

Re: [grpc-io] Closing a stream with a long living context

2017-02-06 Thread Josh Humphries
Perhaps more helpful: in your code example, you would then consume the responses by calling Recv() on the stream until it returns an error (io.EOF on successful end of stream or some other error if the call fails). Even if you are not expecting any response data from the server, you want to call

Re: [grpc-io] Closing a stream with a long living context

2017-02-06 Thread Josh Humphries
On the client, the CloseSend method is "half-closing" the stream. So it closes the request/upload half of the stream. The stream remains open until the server closes the other half: the response/download part of the stream. Cancelling the stream also closes it (as would the channel being

[grpc-io] Closing a stream with a long living context

2017-02-06 Thread Michael Bond
Hey, trying to make sure I'm doing this correctly. Right now I'm having issues with closing streams started with a context that is passed around and exists for quite awhile. In this example "ctx" is passed around to many go routines, I want to keep "ctx" around but passing it to "grpcStream"