Skip to content

Commit ef7392e

Browse files
Remove use of deprecated net.Error.Temporary (#1589)
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 <[email protected]>
1 parent ee99288 commit ef7392e

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

server.go

-6
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,6 @@ func (srv *Server) serveTCP(l net.Listener) error {
476476
if !srv.isStarted() {
477477
return nil
478478
}
479-
if neterr, ok := err.(net.Error); ok && neterr.Temporary() {
480-
continue
481-
}
482479
return err
483480
}
484481
srv.lock.Lock()
@@ -535,9 +532,6 @@ func (srv *Server) serveUDP(l net.PacketConn) error {
535532
if !srv.isStarted() {
536533
return nil
537534
}
538-
if netErr, ok := err.(net.Error); ok && netErr.Temporary() {
539-
continue
540-
}
541535
return err
542536
}
543537
if len(m) < headerSize {

0 commit comments

Comments
 (0)