Commit a1b667f5 authored by Max Lv's avatar Max Lv

Fix the ByteBuffer allocation

parent 700f4d26
......@@ -42,7 +42,7 @@ class LocalDnsWorker(private val resolver: suspend (ByteArray) -> ByteArray, por
}
}?.let { r ->
try {
val response = ByteBuffer.allocate(1024)
val response = ByteBuffer.allocate(r.size)
response.clear()
response.put(r)
response.flip()
......
......@@ -51,7 +51,7 @@ abstract class UdpSocketListener(name: String, val port: Int) : Thread(name) {
udpChannel.use {
while (running) {
try {
val query = ByteBuffer.allocate(1024)
val query = ByteBuffer.allocate(65536)
query.clear()
udpChannel.receive(query)?.let { handle(udpChannel, it, query) }
} catch (e: IOException) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment