Skip to content

Commit

Permalink
Remove use of deprecated net.Error.Temporary
Browse files Browse the repository at this point in the history
net.Error.Temporary has been deprecated since Go 1.18. There
has been some discussion around what to use in server accept loops
instead [1], but the suggestion seems to be that it may be a mistake
to have any sort of retries in place [2].

This PR removes it, which may expose some users to errors that were
previously swallowed and retried, but at the expense of leaking file
descriptors and the like.

1: https://groups.google.com/g/golang-nuts/c/-JcZzOkyqYI/m/xwaZzjCgAwAJ?pli=1
2: https://groups.google.com/g/golang-nuts/c/-JcZzOkyqYI/m/vNNiVn_LAwAJ
  • Loading branch information
johanbrandhorst authored and miekg committed Aug 3, 2024
1 parent 870b1c1 commit 37396bf
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@ func (srv *Server) serveTCP(l net.Listener) error {
if !srv.isStarted() {
return nil
}
if neterr, ok := err.(net.Error); ok && neterr.Temporary() {
continue
}
return err
}
srv.lock.Lock()
Expand Down Expand Up @@ -535,9 +532,6 @@ func (srv *Server) serveUDP(l net.PacketConn) error {
if !srv.isStarted() {
return nil
}
if netErr, ok := err.(net.Error); ok && netErr.Temporary() {
continue
}
return err
}
if len(m) < headerSize {
Expand Down

0 comments on commit 37396bf

Please sign in to comment.