Eliminate proto.Unmarshal in the generated code

This commit is contained in:
iamqizhao
2015-04-27 14:47:09 -07:00
parent 03b78f7e01
commit 0f85408fd4
5 changed files with 16 additions and 16 deletions

View File

@ -49,7 +49,7 @@ import (
"google.golang.org/grpc/transport"
)
type methodHandler func(srv interface{}, ctx context.Context, buf []byte) (interface{}, error)
type methodHandler func(srv interface{}, ctx context.Context, codec Codec, buf []byte) (interface{}, error)
// MethodDesc represents an RPC service's method specification.
type MethodDesc struct {
@ -253,7 +253,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
case compressionNone:
statusCode := codes.OK
statusDesc := ""
reply, appErr := md.Handler(srv.server, stream.Context(), req)
reply, appErr := md.Handler(srv.server, stream.Context(), s.opts.codec, req)
if appErr != nil {
if err, ok := appErr.(rpcError); ok {
statusCode = err.code