grpc client goroutine leak fix
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
9d31078176
commit
dc67083701
@ -43,16 +43,14 @@ func (g *grpcStream) Send(msg interface{}) error {
|
|||||||
func (g *grpcStream) Recv(msg interface{}) (err error) {
|
func (g *grpcStream) Recv(msg interface{}) (err error) {
|
||||||
defer g.setError(err)
|
defer g.setError(err)
|
||||||
if err = g.stream.RecvMsg(msg); err != nil {
|
if err = g.stream.RecvMsg(msg); err != nil {
|
||||||
if err == io.EOF {
|
|
||||||
// #202 - inconsistent gRPC stream behavior
|
// #202 - inconsistent gRPC stream behavior
|
||||||
// the only way to tell if the stream is done is when we get a EOF on the Recv
|
// the only way to tell if the stream is done is when we get a EOF on the Recv
|
||||||
// here we should close the underlying gRPC ClientConn
|
// here we should close the underlying gRPC ClientConn
|
||||||
closeErr := g.conn.Close()
|
closeErr := g.conn.Close()
|
||||||
if closeErr != nil {
|
if err == io.EOF && closeErr != nil {
|
||||||
err = closeErr
|
err = closeErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user