From 39938e9c416f02cefdae627be8ffa4238447c3bd Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 13 Aug 2024 20:39:49 +0200 Subject: [PATCH] Revert "Remove use of deprecated net.Error.Temporary (#1589)" (#1594) This reverts commit ef7392e4ff2ef86bea51ee4f32fc60eaf1c2a88a. See: https://github.com/miekg/dns/pull/1589#issuecomment-2276738695 breaks udp serving --- server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server.go b/server.go index 7a67cf3b4..81580d1e5 100644 --- a/server.go +++ b/server.go @@ -476,6 +476,9 @@ 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() @@ -532,6 +535,9 @@ 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 {