diff --git a/server_https.go b/server_https.go index 6c6d6d3..4c3cf36 100644 --- a/server_https.go +++ b/server_https.go @@ -52,7 +52,9 @@ func (srv *server) handleHTTPReq(w http.ResponseWriter, r *http.Request) { } w.Header().Set("content-type", dnsMsgType) d, _ := m.Pack() - w.Write(d) + if _, err := w.Write(d); err != nil { + log.Errorln(err) + } } func (srv *server) ServeHTTP(w http.ResponseWriter, r *http.Request) { diff --git a/server_tcp.go b/server_tcp.go index 3903d14..9530cad 100644 --- a/server_tcp.go +++ b/server_tcp.go @@ -27,6 +27,9 @@ func (srv *server) handleTCP(c net.Conn) { for _, a := range m.Answer { log.Debugln("result", a.String()) } - conn.WriteMsg(m) + if err := conn.WriteMsg(m); err != nil { + log.Errorln(err) + break + } } } diff --git a/server_udp.go b/server_udp.go index 7531d16..6953463 100644 --- a/server_udp.go +++ b/server_udp.go @@ -24,5 +24,7 @@ func (srv *server) handleUDP(buf []byte, addr net.Addr, conn *net.UDPConn) { log.Debugln("result", a.String()) } d, _ := m.Pack() - conn.WriteTo(d, addr) + if _, err := conn.WriteTo(d, addr); err != nil { + log.Errorln(err) + } }