Index: src/resolver.cr ================================================================== --- src/resolver.cr +++ src/resolver.cr @@ -141,12 +141,10 @@ end end end def handle_packet(packet : Bytes, sender : Socket::IPAddress) : Nil - io = IO::Memory.new(packet, writeable: false) - begin id = packet[0].to_u16 << 8 | packet[1] begin context = @queries[id] @@ -211,14 +209,15 @@ qdcount = io.read_bytes(UInt16, IO::ByteFormat::BigEndian) adcount = io.read_bytes(UInt16, IO::ByteFormat::BigEndian) nscount = io.read_bytes(UInt16, IO::ByteFormat::BigEndian) arcount = io.read_bytes(UInt16, IO::ByteFormat::BigEndian) rescue IndexError + rescue IO::EOFError end end def stop : Nil @v6_sock.try { |s| s.close } @v4_sock.try { |s| s.close } end end end