add cruft

This commit is contained in:
Asim Aslam
2019-06-17 20:05:58 +01:00
committed by Vasiliy Tolstov
parent 0ecc1d6197
commit 76265b618b
2 changed files with 100 additions and 1 deletions

13
grpc.go
View File

@@ -177,7 +177,10 @@ func (g *grpcClient) stream(ctx context.Context, node *registry.Node, req client
dialCtx, cancel = context.WithCancel(ctx)
}
defer cancel()
cc, err := grpc.DialContext(dialCtx, address, grpc.WithDefaultCallOptions(grpc.ForceCodec(cf)), g.secure())
wc := wrapCodec{cf}
cc, err := grpc.DialContext(dialCtx, address, grpc.WithDefaultCallOptions(grpc.ForceCodec(wc)), g.secure())
if err != nil {
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error sending request: %v", err))
}
@@ -193,6 +196,14 @@ func (g *grpcClient) stream(ctx context.Context, node *registry.Node, req client
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error creating stream: %v", err))
}
// set request codec
if r, ok := req.(*grpcRequest); ok {
r.codec = &grpcCodec{
s: st,
c: wc,
}
}
rsp := &response{
conn: cc,
stream: st,