Skip to content

Commit

Permalink
feat: connection add debug log (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
twz915 committed Dec 6, 2023
1 parent 5af5d6d commit af567d2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/remote/remote_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,20 @@ func (c *remotingClient) receiveResponse(r *tcpConnWrapper) {
return
}
// ignore name server connection read timeout
var isTimeout bool
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
rlog.Debug("conn error, close connection", map[string]interface{}{
isTimeout = true
}
if !(err == io.EOF || isTimeout) {
rlog.Error("conn error, close connection", map[string]interface{}{
"remoteAddr": r.RemoteAddr(),
"localAddr": r.LocalAddr(),
rlog.LogKeyUnderlayError: err,
})
} else if err != io.EOF {
rlog.Error("conn error, close connection", map[string]interface{}{
} else {
rlog.Debug("conn error, close connection", map[string]interface{}{
"remoteAddr": r.RemoteAddr(),
"localAddr": r.LocalAddr(),
rlog.LogKeyUnderlayError: err,
})
}
Expand Down

0 comments on commit af567d2

Please sign in to comment.