diff --git a/rpc/http.go b/rpc/http.go index 3b708603fe..0de127c808 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -47,7 +47,7 @@ type httpConn struct { client *http.Client req *http.Request closeOnce sync.Once - closeCh chan interface{} + closeCh chan interface{} } // httpConn is treated specially by Client. diff --git a/rpc/ipc.go b/rpc/ipc.go index b26d005805..07a211c627 100644 --- a/rpc/ipc.go +++ b/rpc/ipc.go @@ -54,4 +54,3 @@ func DialIPC(ctx context.Context, endpoint string) (*Client, error) { return NewCodec(conn), err }) } - diff --git a/rpc/json.go b/rpc/json.go index db2c1f7e30..ad7294d315 100644 --- a/rpc/json.go +++ b/rpc/json.go @@ -164,24 +164,24 @@ func (c connWithRemoteAddr) RemoteAddr() string { return c.addr } // jsonCodec reads and writes JSON-RPC messages to the underlying connection. It also has // support for parsing arguments and serializing (result) objects. type jsonCodec struct { - remote string - closer sync.Once // close closed channel once - closeCh chan interface{} // closed on Close - decode func(v interface{}) error // decoder to allow multiple transports - encMu sync.Mutex // guards the encoder - encode func(v interface{}) error // encoder to allow multiple transports - conn deadlineCloser + remote string + closer sync.Once // close closed channel once + closeCh chan interface{} // closed on Close + decode func(v interface{}) error // decoder to allow multiple transports + encMu sync.Mutex // guards the encoder + encode func(v interface{}) error // encoder to allow multiple transports + conn deadlineCloser } -// NewCodec creates a codec which uses the given functions to read and write. If conn +// NewFuncCodec creates a codec which uses the given functions to read and write. If conn // implements ConnRemoteAddr, log messages will use it to include the remote address of // the connection. func NewFuncCodec(conn deadlineCloser, encode, decode func(v interface{}) error) ServerCodec { codec := &jsonCodec{ closeCh: make(chan interface{}), - encode: encode, - decode: decode, - conn: conn, + encode: encode, + decode: decode, + conn: conn, } if ra, ok := conn.(ConnRemoteAddr); ok { codec.remote = ra.RemoteAddr() diff --git a/rpc/server.go b/rpc/server.go index 2e56112968..ddd7c744c0 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -66,7 +66,7 @@ func (s *Server) RegisterName(name string, receiver interface{}) error { return s.services.registerName(name, receiver) } -// receiver reads incoming requests from codec, calls the appropriate callback and writes +// ServeCodec reads incoming requests from codec, calls the appropriate callback and writes // the response back using the given codec. It will block until the codec is closed or the // server is stopped. In either case the codec is closed. //