forked from TrueCloudLab/frostfs-api-go
[#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:
parent
066a2dba74
commit
22ce8e13cc
1 changed files with 22 additions and 0 deletions
22
rpc/client/conn.go
Normal file
22
rpc/client/conn.go
Normal 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
|
||||||
|
}
|
Loading…
Reference in a new issue