[#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>
support/v2.15
Leonard Lyubich 2021-05-31 09:18:23 +03:00 committed by Leonard Lyubich
parent 066a2dba74
commit 22ce8e13cc
1 changed files with 22 additions and 0 deletions

22
rpc/client/conn.go 100644
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
}