addressed some comments

This commit is contained in:
iamqizhao
2015-04-01 14:22:53 -07:00
parent bec42c09aa
commit c7b9fa27dc
2 changed files with 4 additions and 4 deletions

View File

@ -66,9 +66,9 @@ type dialOptions struct {
type DialOption func(*dialOptions) type DialOption func(*dialOptions)
// WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling. // WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling.
func WithCodec(codec Codec) DialOption { func WithCodec(c Codec) DialOption {
return func(o *dialOptions) { return func(o *dialOptions) {
o.codec = codec o.codec = c
} }
} }
@ -110,7 +110,7 @@ func Dial(target string, opts ...DialOption) (*ClientConn, error) {
} }
if cc.dopts.codec == nil { if cc.dopts.codec == nil {
// Set the default codec. // Set the default codec.
cc.dopts.codec = &protoCodec{} cc.dopts.codec = protoCodec{}
} }
if err := cc.resetTransport(false); err != nil { if err := cc.resetTransport(false); err != nil {
return nil, err return nil, err

View File

@ -115,7 +115,7 @@ func NewServer(opt ...ServerOption) *Server {
} }
if opts.codec == nil { if opts.codec == nil {
// Set the default codec. // Set the default codec.
opts.codec = &protoCodec{} opts.codec = protoCodec{}
} }
return &Server{ return &Server{
lis: make(map[net.Listener]bool), lis: make(map[net.Listener]bool),