remove duplicate check
This commit is contained in:
14
server.go
14
server.go
@ -256,7 +256,6 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
traceInfo.firstLine.client = false
|
traceInfo.firstLine.client = false
|
||||||
traceInfo.tr.LazyLog(&traceInfo.firstLine, false)
|
traceInfo.tr.LazyLog(&traceInfo.firstLine, false)
|
||||||
defer func() {
|
defer func() {
|
||||||
// The trace only log the first operation err and dosen't log the application error
|
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||||
traceInfo.tr.SetError()
|
traceInfo.tr.SetError()
|
||||||
@ -346,18 +345,14 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
ss.traceInfo.tr.LazyLog(&ss.traceInfo.firstLine, false)
|
ss.traceInfo.tr.LazyLog(&ss.traceInfo.firstLine, false)
|
||||||
defer func() {
|
defer func() {
|
||||||
ss.mu.Lock()
|
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.Finish()
|
||||||
ss.traceInfo.tr = nil
|
ss.traceInfo.tr = nil
|
||||||
ss.mu.Unlock()
|
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 appErr := sd.Handler(srv.server, ss); appErr != nil {
|
||||||
if err, ok := appErr.(rpcError); ok {
|
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?
|
// Unary RPC or Streaming RPC?
|
||||||
if md, ok := srv.md[method]; ok {
|
if md, ok := srv.md[method]; ok {
|
||||||
|
|
||||||
s.processUnaryRPC(t, stream, srv, md)
|
s.processUnaryRPC(t, stream, srv, md)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
27
stream.go
27
stream.go
@ -311,14 +311,13 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) {
|
|||||||
defer func() {
|
defer func() {
|
||||||
if ss.tracing {
|
if ss.tracing {
|
||||||
ss.mu.Lock()
|
ss.mu.Lock()
|
||||||
if ss.traceInfo.tr != nil {
|
if err == nil {
|
||||||
if err == nil {
|
ss.traceInfo.tr.LazyLog(&payload{sent: true, msg: m}, true)
|
||||||
ss.traceInfo.tr.LazyLog(&payload{sent: true, msg: m}, true)
|
} else {
|
||||||
} else {
|
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
ss.traceInfo.tr.SetError()
|
||||||
ss.traceInfo.tr.SetError()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.mu.Unlock()
|
ss.mu.Unlock()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -334,15 +333,11 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) {
|
|||||||
defer func() {
|
defer func() {
|
||||||
if ss.tracing {
|
if ss.tracing {
|
||||||
ss.mu.Lock()
|
ss.mu.Lock()
|
||||||
if ss.traceInfo.tr != nil {
|
if err == nil {
|
||||||
if err == nil {
|
ss.traceInfo.tr.LazyLog(&payload{sent: false, msg: m}, true)
|
||||||
ss.traceInfo.tr.LazyLog(&payload{sent: false, msg: m}, true)
|
} else if err != io.EOF {
|
||||||
} else {
|
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
||||||
if err != io.EOF {
|
ss.traceInfo.tr.SetError()
|
||||||
ss.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
|
|
||||||
ss.traceInfo.tr.SetError()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ss.mu.Unlock()
|
ss.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user