[#196] rpc/grpc: Implement Client.Conn method

Implement `Client.Conn` method which returns underlying connection as
`io.Closer`. Method is going to be used for forwarding the connection to
superior clients.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/feature/refactor-sig-rpc
Leonard Lyubich 2021-05-31 09:16:57 +03:00 committed by Leonard Lyubich
parent 6cd3497388
commit 066a2dba74
1 changed files with 19 additions and 0 deletions

19
rpc/grpc/conn.go 100644
View File

@ -0,0 +1,19 @@
package grpc
import (
"io"
)
// Conn returns underlying connection.
//
// Conn is NPE-safe: returns nil if Client is nil.
//
// Client should not be used after Close() call
// on the connection: behavior is undefined.
func (c *Client) Conn() io.Closer {
if c != nil {
return c.con
}
return nil
}