Use multiplexed connection in NewFromConn()
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
27cd275ddb
commit
de3ce406e7
14
api/api.go
14
api/api.go
@ -6,7 +6,6 @@ import (
|
|||||||
|
|
||||||
"go.arsenm.dev/itd/internal/rpc"
|
"go.arsenm.dev/itd/internal/rpc"
|
||||||
"storj.io/drpc"
|
"storj.io/drpc"
|
||||||
"storj.io/drpc/drpcconn"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const DefaultAddr = "/tmp/itd/socket"
|
const DefaultAddr = "/tmp/itd/socket"
|
||||||
@ -33,13 +32,16 @@ func New(sockPath string) (*Client, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFromConn(conn io.ReadWriteCloser) *Client {
|
func NewFromConn(conn io.ReadWriteCloser) (*Client, error) {
|
||||||
dconn := drpcconn.New(conn)
|
mconn, err := newMuxConn(conn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &Client{
|
return &Client{
|
||||||
conn: dconn,
|
conn: mconn,
|
||||||
client: rpc.NewDRPCITDClient(dconn),
|
client: rpc.NewDRPCITDClient(mconn),
|
||||||
}
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) FS() *FSClient {
|
func (c *Client) FS() *FSClient {
|
||||||
|
Loading…
Reference in New Issue
Block a user