Nice, this looks solid to me :).

On Friday, July 23, 2021 at 4:42:12 AM UTC-4 amits...@gmail.com wrote:

>
>
> > On 11 Jul 2021, at 10:37 am, Amit Saha <amits...@gmail.com> wrote:
> > 
> > Hi all,
> > 
> > I am implementing a reconnection logic in my client for a bidi RPC 
> method.
> > 
> > This is similar to what
> > 
> https://stackoverflow.com/questions/66353603/correct-way-to-perform-a-reconnect-with-grpc-client
> > seeks to do. The summary version is:
> > 
> > If Recv() returns an error other than io.EOF, reconnect/recreate the
> > streaming connection.
> > 
> > However, this logic doesn't quite seem straightforward with the Send()
> > method (I think). Unlike the Recv() method, the Send() method's error
> > in this scenario is an io.EOF,
> > not a "transport is closing" error. Thus, it's tricky to assume that
> > the error means we should create a new stream.
>
> I think this may work:
>
> If we get an io.EOF error from the Send() method, and we call the 
> RecvMsg() method, we can make use of the error value returned by this 
> method to deduce an abnormal termination:
>
> err := stream.Send(&r)
> if err == io.EOF {
>
> var m respoonseType
>
> err := stream.RecvMsg(&m)
>
> if err != nil {
>
> // Implement stream recreation logic
>
> }
>
> ..
> }
>
>
>
>
>
> > 
> > What are the community's thoughts on this?
> > 
> > Thanks,
> > Amit.
>
>

-- 
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 grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/6c77845f-591b-4b05-80f9-a2480817908en%40googlegroups.com.

Reply via email to