diff --git a/server/rpc_codec.go b/server/rpc_codec.go index 7ce3c15d..87a32795 100644 --- a/server/rpc_codec.go +++ b/server/rpc_codec.go @@ -10,7 +10,7 @@ import ( "github.com/pkg/errors" ) -type rpcPlusCodec struct { +type rpcCodec struct { socket transport.Socket codec codec.Codec @@ -47,12 +47,12 @@ func (rwc *readWriteCloser) Close() error { return nil } -func newRpcPlusCodec(req *transport.Message, socket transport.Socket, c codec.NewCodec) serverCodec { +func newRpcCodec(req *transport.Message, socket transport.Socket, c codec.NewCodec) serverCodec { rwc := &readWriteCloser{ rbuf: bytes.NewBuffer(req.Body), wbuf: bytes.NewBuffer(nil), } - r := &rpcPlusCodec{ + r := &rpcCodec{ buf: rwc, codec: c(rwc), req: req, @@ -61,7 +61,7 @@ func newRpcPlusCodec(req *transport.Message, socket transport.Socket, c codec.Ne return r } -func (c *rpcPlusCodec) ReadRequestHeader(r *request, first bool) error { +func (c *rpcCodec) ReadRequestHeader(r *request, first bool) error { m := codec.Message{Header: c.req.Header} if !first { @@ -83,11 +83,11 @@ func (c *rpcPlusCodec) ReadRequestHeader(r *request, first bool) error { return err } -func (c *rpcPlusCodec) ReadRequestBody(b interface{}) error { +func (c *rpcCodec) ReadRequestBody(b interface{}) error { return c.codec.ReadBody(b) } -func (c *rpcPlusCodec) WriteResponse(r *response, body interface{}, last bool) error { +func (c *rpcCodec) WriteResponse(r *response, body interface{}, last bool) error { c.buf.wbuf.Reset() m := &codec.Message{ Method: r.ServiceMethod, @@ -111,7 +111,7 @@ func (c *rpcPlusCodec) WriteResponse(r *response, body interface{}, last bool) e }) } -func (c *rpcPlusCodec) Close() error { +func (c *rpcCodec) Close() error { c.buf.Close() c.codec.Close() return c.socket.Close() diff --git a/server/rpc_codec_test.go b/server/rpc_codec_test.go index 9ef8e7fa..d2aec28a 100644 --- a/server/rpc_codec_test.go +++ b/server/rpc_codec_test.go @@ -38,7 +38,7 @@ func TestCodecWriteError(t *testing.T) { wbuf: new(bytes.Buffer), } - c := rpcPlusCodec{ + c := rpcCodec{ buf: &rwc, codec: &testCodec{ buf: rwc.wbuf, diff --git a/server/rpc_server.go b/server/rpc_server.go index bd6b04fa..171848b0 100644 --- a/server/rpc_server.go +++ b/server/rpc_server.go @@ -87,7 +87,7 @@ func (s *rpcServer) accept(sock transport.Socket) { return } - codec := newRpcPlusCodec(&msg, sock, cf) + codec := newRpcCodec(&msg, sock, cf) // strip our headers hdr := make(map[string]string)