From 7172d5c7a66de543de4beb3ed5e0a9eafa1f43af Mon Sep 17 00:00:00 2001 From: iamqizhao Date: Thu, 14 Jan 2016 14:53:07 -0800 Subject: [PATCH] Still show trace for the client streams which failed to create --- stream.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stream.go b/stream.go index 698d7494..3ac5f6a6 100644 --- a/stream.go +++ b/stream.go @@ -114,10 +114,6 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth codec: cc.dopts.codec, tracing: EnableTracing, } - s, err := t.NewStream(ctx, callHdr) - if err != nil { - return nil, toRPCErr(err) - } if cs.tracing { cs.trInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) cs.trInfo.firstLine.client = true @@ -127,6 +123,11 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth cs.trInfo.tr.LazyLog(&cs.trInfo.firstLine, false) ctx = trace.NewContext(ctx, cs.trInfo.tr) } + s, err := t.NewStream(ctx, callHdr) + if err != nil { + cs.finish(err) + return nil, toRPCErr(err) + } cs.t = t cs.s = s cs.p = &parser{s: s}