remove duplicate check
This commit is contained in:
Родитель
2574b59392
Коммит
0231ff14bc
14
server.go
14
server.go
|
@ -256,7 +256,6 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||
traceInfo.firstLine.client = false
|
||||
traceInfo.tr.LazyLog(&traceInfo.firstLine, false)
|
||||
defer func() {
|
||||
// The trace only log the first operation err and dosen't log the application error
|
||||
if err != nil && err != io.EOF {
|
||||
traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||
traceInfo.tr.SetError()
|
||||
|
@ -346,18 +345,14 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||
ss.traceInfo.tr.LazyLog(&ss.traceInfo.firstLine, false)
|
||||
defer func() {
|
||||
ss.mu.Lock()
|
||||
if err != nil {
|
||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||
ss.traceInfo.tr.SetError()
|
||||
}
|
||||
ss.traceInfo.tr.Finish()
|
||||
ss.traceInfo.tr = nil
|
||||
ss.mu.Unlock()
|
||||
}()
|
||||
defer func() {
|
||||
if err != nil {
|
||||
ss.mu.Lock()
|
||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||
ss.traceInfo.tr.SetError()
|
||||
ss.mu.Unlock()
|
||||
}
|
||||
}()
|
||||
}
|
||||
if appErr := sd.Handler(srv.server, ss); appErr != nil {
|
||||
if err, ok := appErr.(rpcError); ok {
|
||||
|
@ -396,7 +391,6 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str
|
|||
}
|
||||
// Unary RPC or Streaming RPC?
|
||||
if md, ok := srv.md[method]; ok {
|
||||
|
||||
s.processUnaryRPC(t, stream, srv, md)
|
||||
return
|
||||
}
|
||||
|
|
27
stream.go
27
stream.go
|
@ -311,14 +311,13 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) {
|
|||
defer func() {
|
||||
if ss.tracing {
|
||||
ss.mu.Lock()
|
||||
if ss.traceInfo.tr != nil {
|
||||
if err == nil {
|
||||
ss.traceInfo.tr.LazyLog(&payload{sent: true, msg: m}, true)
|
||||
} else {
|
||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||
ss.traceInfo.tr.SetError()
|
||||
}
|
||||
if err == nil {
|
||||
ss.traceInfo.tr.LazyLog(&payload{sent: true, msg: m}, true)
|
||||
} else {
|
||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||
ss.traceInfo.tr.SetError()
|
||||
}
|
||||
|
||||
ss.mu.Unlock()
|
||||
}
|
||||
}()
|
||||
|
@ -334,15 +333,11 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) {
|
|||
defer func() {
|
||||
if ss.tracing {
|
||||
ss.mu.Lock()
|
||||
if ss.traceInfo.tr != nil {
|
||||
if err == nil {
|
||||
ss.traceInfo.tr.LazyLog(&payload{sent: false, msg: m}, true)
|
||||
} else {
|
||||
if err != io.EOF {
|
||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||
ss.traceInfo.tr.SetError()
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
ss.traceInfo.tr.LazyLog(&payload{sent: false, msg: m}, true)
|
||||
} else if err != io.EOF {
|
||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||
ss.traceInfo.tr.SetError()
|
||||
}
|
||||
ss.mu.Unlock()
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче