check in cruft

This commit is contained in:
Asim Aslam 2019-06-11 09:52:35 +01:00
parent 070bd40b4c
commit 235a653f78
4 changed files with 28 additions and 27 deletions

View File

@ -6,9 +6,9 @@ import (
"context" "context"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"os"
"sync" "sync"
"time" "time"
"os"
"github.com/micro/go-micro/broker" "github.com/micro/go-micro/broker"
"github.com/micro/go-micro/client" "github.com/micro/go-micro/client"
@ -112,7 +112,7 @@ func (g *grpcClient) call(ctx context.Context, node *registry.Node, req client.R
var grr error var grr error
cc, err := g.pool.getConn(address, grpc.WithDefaultCallOptions(grpc.CallCustomCodec(cf)), cc, err := g.pool.getConn(address, grpc.WithDefaultCallOptions(grpc.ForceCodec(cf)),
grpc.WithTimeout(opts.DialTimeout), g.secure(), grpc.WithTimeout(opts.DialTimeout), g.secure(),
grpc.WithDefaultCallOptions( grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(maxRecvMsgSize), grpc.MaxCallRecvMsgSize(maxRecvMsgSize),
@ -129,7 +129,7 @@ func (g *grpcClient) call(ctx context.Context, node *registry.Node, req client.R
ch := make(chan error, 1) ch := make(chan error, 1)
go func() { go func() {
err := cc.Invoke(ctx, methodToGRPC(req.Endpoint(), req.Body()), req.Body(), rsp, grpc.CallContentSubtype(cf.String())) err := cc.Invoke(ctx, methodToGRPC(req.Endpoint(), req.Body()), req.Body(), rsp, grpc.ForceCodec(cf))
ch <- microError(err) ch <- microError(err)
}() }()
@ -230,7 +230,7 @@ func (g *grpcClient) maxSendMsgSizeValue() int {
return v.(int) return v.(int)
} }
func (g *grpcClient) newGRPCCodec(contentType string) (grpc.Codec, error) { func (g *grpcClient) newGRPCCodec(contentType string) (encoding.Codec, error) {
codecs := make(map[string]encoding.Codec) codecs := make(map[string]encoding.Codec)
if g.opts.Context != nil { if g.opts.Context != nil {
if v := g.opts.Context.Value(codecsKey{}); v != nil { if v := g.opts.Context.Value(codecsKey{}); v != nil {

View File

@ -5,12 +5,13 @@ import (
"github.com/micro/go-micro/codec" "github.com/micro/go-micro/codec"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/encoding"
) )
type response struct { type response struct {
conn *grpc.ClientConn conn *grpc.ClientConn
stream grpc.ClientStream stream grpc.ClientStream
codec grpc.Codec codec encoding.Codec
} }
// Read the response // Read the response