From be4cb2a81abe9fb107b7fd3c2b26bf85d10932f4 Mon Sep 17 00:00:00 2001 From: yangzhouhan Date: Fri, 24 Jul 2015 15:39:25 -0700 Subject: [PATCH] relocate response log --- stream.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/stream.go b/stream.go index 256d0f01..47e8af5a 100644 --- a/stream.go +++ b/stream.go @@ -191,19 +191,6 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { } func (cs *clientStream) RecvMsg(m interface{}) (err error) { - if cs.tracing { - cs.mu.Lock() - if cs.traceInfo.tr != nil { - if cs.traceInfo.tr != nil { - p := &payload{ - sent: false, - msg: m, - } - cs.traceInfo.tr.LazyLog(p, true) - } - } - cs.mu.Unlock() - } err = recv(cs.p, cs.codec, m) defer func() { // err != nil indicates the termination of the stream. @@ -212,6 +199,19 @@ func (cs *clientStream) RecvMsg(m interface{}) (err error) { } }() if err == nil { + if cs.tracing { + cs.mu.Lock() + if cs.traceInfo.tr != nil { + if cs.traceInfo.tr != nil { + p := &payload{ + sent: false, + msg: m, + } + cs.traceInfo.tr.LazyLog(p, true) + } + } + cs.mu.Unlock() + } if !cs.desc.ClientStreams || cs.desc.ServerStreams { return }