From cb8ba30ac531eeb10b50716bed3e8a1027bf88a2 Mon Sep 17 00:00:00 2001 From: orb li Date: Thu, 10 Oct 2019 13:55:16 +0800 Subject: [PATCH] Conceptual deliverable --- grpc.go | 4 ++-- options.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/grpc.go b/grpc.go index 63c36c3..fd5bc85 100644 --- a/grpc.go +++ b/grpc.go @@ -541,11 +541,11 @@ func (g *grpcClient) String() string { } func (g *grpcClient) getGrpcDialOptions() []grpc.DialOption { - if g.opts.Context == nil { + if g.opts.CallOptions.Context == nil { return nil } - v := g.opts.Context.Value(grpcDialOptions{}) + v := g.opts.CallOptions.Context.Value(grpcDialOptions{}) if v == nil { return nil diff --git a/options.go b/options.go index dc67419..e7f2fce 100644 --- a/options.go +++ b/options.go @@ -79,8 +79,8 @@ func MaxSendMsgSize(s int) client.Option { // // DialOptions to be used to configure gRPC dial options // -func DialOptions(opts ...grpc.DialOption) client.Option { - return func(o *client.Options) { +func DialOptions(opts ...grpc.DialOption) client.CallOption { + return func(o *client.CallOptions) { if o.Context == nil { o.Context = context.Background() } @@ -91,11 +91,11 @@ func DialOptions(opts ...grpc.DialOption) client.Option { // // CallOptions to be used to configure gRPC call options // -func CallOptions(opts ...grpc.CallOption) client.Option { - return func(o *client.Options) { - if o.CallOptions.Context == nil { - o.CallOptions.Context = context.Background() +func CallOptions(opts ...grpc.CallOption) client.CallOption { + return func(o *client.CallOptions) { + if o.Context == nil { + o.Context = context.Background() } - o.CallOptions.Context = context.WithValue(o.CallOptions.Context, grpcCallOptions{}, opts) + o.Context = context.WithValue(o.Context, grpcCallOptions{}, opts) } }