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

Implement `Client.Conn` which returns the connection of the underlying
transport client. The method is going to be used for forwarding the
connection to superior clients.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-31 09:18:23 +03:00 committed by Leonard Lyubich
parent 066a2dba74
commit 22ce8e13cc

22
rpc/client/conn.go Normal file
View file

@ -0,0 +1,22 @@
package client
import (
"io"
)
// Conn returns underlying connection.
//
// Returns non-nil result after the first Init() call
// completed without a connection error.
//
// 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.gRPCClient.Conn()
}
return nil
}