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