修复dubbo协议的报错信息,不打印堆栈

This commit is contained in:
hmzzrcs
2024-05-20 16:43:57 +08:00
parent a674adb418
commit 303ff413ef

View File

@@ -21,6 +21,7 @@ import (
"context" "context"
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"errors"
"fmt" "fmt"
"github.com/eolinker/eosc/log" "github.com/eolinker/eosc/log"
"net" "net"
@@ -270,7 +271,7 @@ func (s *server) accept(newSession NewSessionCallback) (Session, error) {
return nil, perrors.WithStack(err) return nil, perrors.WithStack(err)
} }
if gxnet.IsSameAddr(conn.RemoteAddr(), conn.LocalAddr()) { if gxnet.IsSameAddr(conn.RemoteAddr(), conn.LocalAddr()) {
log.Warnf("conn.localAddr{%s} == conn.RemoteAddr", conn.LocalAddr().String(), conn.RemoteAddr().String()) log.Warnf("conn.localAddr{%s} == conn.RemoteAddr{%s}", conn.LocalAddr().String(), conn.RemoteAddr().String())
return nil, perrors.WithStack(errSelfConnect) return nil, perrors.WithStack(errSelfConnect)
} }
@@ -303,7 +304,8 @@ func (s *server) runTCPEventLoop(newSession NewSessionCallback) {
} }
client, err = s.accept(newSession) client, err = s.accept(newSession)
if err != nil { if err != nil {
if netErr, ok := perrors.Cause(err).(net.Error); ok && netErr.Timeout() { var netErr net.Error
if errors.As(perrors.Cause(err), &netErr) && netErr.Timeout() {
if delay == 0 { if delay == 0 {
delay = 5 * time.Millisecond delay = 5 * time.Millisecond
} else { } else {
@@ -314,8 +316,8 @@ func (s *server) runTCPEventLoop(newSession NewSessionCallback) {
} }
continue continue
} }
log.Warnf("server{%s}.Accept() = err {%+v}", s.addr, perrors.WithStack(err)) log.Warnf("server{%s}.Accept() = err {%+v}", s.addr, perrors.Cause(err))
continue break
} }
delay = 0 delay = 0
client.(*session).run() client.(*session).run()