remove duplicate nil check separate var
This commit is contained in:
Родитель
be4cb2a81a
Коммит
e79ac3cb4b
12
call.go
12
call.go
|
@ -164,11 +164,7 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
|
|||
return toRPCErr(err)
|
||||
}
|
||||
if EnableTracing {
|
||||
p := &payload{
|
||||
sent: true,
|
||||
msg: args,
|
||||
}
|
||||
c.traceInfo.tr.LazyLog(p, true)
|
||||
c.traceInfo.tr.LazyLog(&payload{sent: true, msg: args}, true)
|
||||
}
|
||||
stream, err = sendRequest(ctx, cc.dopts.codec, callHdr, t, args, topts)
|
||||
if err != nil {
|
||||
|
@ -187,11 +183,7 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
|
|||
continue
|
||||
}
|
||||
if EnableTracing {
|
||||
p := &payload{
|
||||
sent: false,
|
||||
msg: reply,
|
||||
}
|
||||
c.traceInfo.tr.LazyLog(p, true)
|
||||
c.traceInfo.tr.LazyLog(&payload{sent: false, msg: reply}, true)
|
||||
}
|
||||
t.CloseStream(stream, lastErr)
|
||||
if lastErr != nil {
|
||||
|
|
14
stream.go
14
stream.go
|
@ -166,11 +166,7 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) {
|
|||
if cs.tracing {
|
||||
cs.mu.Lock()
|
||||
if cs.traceInfo.tr != nil {
|
||||
p := &payload{
|
||||
sent: true,
|
||||
msg: m,
|
||||
}
|
||||
cs.traceInfo.tr.LazyLog(p, true)
|
||||
cs.traceInfo.tr.LazyLog(&payload{sent: true, msg: m}, true)
|
||||
}
|
||||
cs.mu.Unlock()
|
||||
}
|
||||
|
@ -202,13 +198,7 @@ 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.traceInfo.tr.LazyLog(&payload{sent: false, msg: m}, true)
|
||||
}
|
||||
cs.mu.Unlock()
|
||||
}
|
||||
|
|
2
trace.go
2
trace.go
|
@ -93,7 +93,7 @@ func (f *firstLine) String() string {
|
|||
|
||||
// payload represents an RPC request or response payload.
|
||||
type payload struct {
|
||||
sent bool // whether this is a request or response
|
||||
sent bool // whether this is an outgoing payload
|
||||
msg interface{} // e.g. a proto.Message
|
||||
// TODO(dsymonds): add stringifying info to codec, and limit how much we hold here?
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче