Use io.ReadWriteCloser instead of net.Conn in client
This commit is contained in:
parent
4d0c9da4d9
commit
5e99a66007
@ -21,7 +21,7 @@ package client
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ var (
|
|||||||
|
|
||||||
// Client is an lrpc client
|
// Client is an lrpc client
|
||||||
type Client struct {
|
type Client struct {
|
||||||
conn net.Conn
|
conn io.ReadWriteCloser
|
||||||
codec codec.Codec
|
codec codec.Codec
|
||||||
|
|
||||||
chMtx sync.Mutex
|
chMtx sync.Mutex
|
||||||
@ -52,7 +52,7 @@ type Client struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// New creates and returns a new client
|
// New creates and returns a new client
|
||||||
func New(conn net.Conn, cf codec.CodecFunc) *Client {
|
func New(conn io.ReadWriteCloser, cf codec.CodecFunc) *Client {
|
||||||
out := &Client{
|
out := &Client{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
codec: cf(conn),
|
codec: cf(conn),
|
||||||
|
Reference in New Issue
Block a user