Skip to content

Commit

Permalink
skip timeout error to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
z0rr0 committed Sep 20, 2024
1 parent 2517873 commit fd015ff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ func (s *Server) handle(p *Params, conn net.Conn, semaphore <-chan struct{}) {
}()

if err = s.S.ServeConn(conn); err != nil {
s.logInfo.Printf("failed to serve connection from client %q: %v", client, err)
var nErr net.Error
if errors.As(err, &nErr) && nErr.Timeout() {
s.logDebug.Printf("connection from %s is closed due to timeout: %v", client, err)
} else {
s.logInfo.Printf("failed to serve connection from client %q: %v", client, err)
}
} else {
s.logDebug.Printf("connection served from %s during %v", client, time.Since(t))
}
Expand Down

0 comments on commit fd015ff

Please sign in to comment.