Skip to content

Commit

Permalink
log the whole message cause high cpu consumption #11
Browse files Browse the repository at this point in the history
  • Loading branch information
stou committed Aug 8, 2023
1 parent 81c80d9 commit c593854
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,10 @@ func (p *Proxy) getNextRequestHop(msg *Message) (host string, port int, transpor
func (p *Proxy) getNextRequestHopByConfig(msg *Message) (host string, port int, transport string, err error) {
to, err := msg.GetTo()
if err != nil {
zap.L().Warn("Fail to find the header To in message", zap.String("message", msg.String()))
return "", 0, "", fmt.Errorf("No To header in message")
}
destHost, err := to.GetHost()
if err != nil {
zap.L().Warn("Fail to find the Host in header To of message", zap.String("message", msg.String()))
return "", 0, "", fmt.Errorf("Fail to find Host in To header of message")
}
transport, host, port, err = p.preConfigRoute.FindRoute(destHost)
Expand Down
2 changes: 1 addition & 1 deletion transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (u *UDPClientTransport) Send(msg *Message) error {
}
n, err := u.conn.WriteToUDP(b, u.remoteAddr)
if err == nil {
zap.L().Info("Succeed to send message", zap.Int("length", n), zap.String("localAddr", u.localAddr.String()), zap.String("remoteAddr", u.remoteAddr.String()), zap.String("message", msg.String()))
zap.L().Info("Succeed to send message", zap.Int("length", n), zap.String("localAddr", u.localAddr.String()), zap.String("remoteAddr", u.remoteAddr.String()))
} else {
zap.L().Error("Fail to send message", zap.String("localAddr", u.localAddr.String()), zap.String("remoteAddr", u.remoteAddr.String()), zap.String("message", msg.String()), zap.String("error", err.Error()))
}
Expand Down

0 comments on commit c593854

Please sign in to comment.