Skip to content

Commit

Permalink
Remove use of deprecated net.Error.Temporary (#1589)
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

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
  • Loading branch information
miekg and johanbrandhorst authored Aug 3, 2024
1 parent ee99288 commit ef7392e
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 ef7392e

Please sign in to comment.