Skip to content

Commit bc12b18

Browse files
author
vaclavvondruska
committed
Fixing ignoring unknown RR types - in progress
1 parent 0eed230 commit bc12b18

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/scala/client/DNSClient.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package client
22

33
import payload.Question
4-
import collection.mutable
4+
import collection.concurrent
55
import payload.Message
66
import utils.RequestIdGenerator
77
import payload.Header
@@ -16,8 +16,9 @@ import enums.RecordType
1616
object DNSClient {
1717

1818
val logger = LoggerFactory.getLogger("app")
19-
val addresses: mutable.ConcurrentMap[Int, (String, Int)] = new ConcurrentHashMap[Int, (String, Int)]
20-
val callbacks: mutable.ConcurrentMap[Int, Message => Unit] = new ConcurrentHashMap[Int, Message => Unit]
19+
20+
val addresses: concurrent.Map[Int, (String, Int)] = new ConcurrentHashMap[Int, (String, Int)]
21+
val callbacks: concurrent.Map[Int, Message => Unit] = new ConcurrentHashMap[Int, Message => Unit]
2122

2223
def send(address: String, port: Int, questions: List[(List[String], Int, Int)])(callback: Message => Unit): Unit = {
2324
val questionArray = questions.map { case(qname, qtype, qclass) =>

src/main/scala/payload/Message.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ object Message {
8383
if (n >= 1) Array.tabulate(n) { i => Question(buf, o) } else Array()
8484

8585
def deserializeRRData(buf: ChannelBuffer, n: Int, o: Int): Array[RRData] =
86-
if (n >= 1) Array.tabulate(n) { i => RRData(buf, o) } else Array()
86+
if (n >= 1) Array.tabulate(n) { i => RRData(buf, o) }.filter(_.rdata != null) else Array()
8787
}

0 commit comments

Comments
 (0)