Use io.ReadWriteCloser instead of net.Conn in client

This commit is contained in:
Elara 2022-05-02 16:24:50 -07:00
parent 4d0c9da4d9
commit 5e99a66007

View File

@ -21,7 +21,7 @@ package client
import (
"context"
"errors"
"net"
"io"
"reflect"
"sync"
@ -44,7 +44,7 @@ var (
// Client is an lrpc client
type Client struct {
conn net.Conn
conn io.ReadWriteCloser
codec codec.Codec
chMtx sync.Mutex
@ -52,7 +52,7 @@ type Client struct {
}
// 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{
conn: conn,
codec: cf(conn),