1. increased buffer size

This commit is contained in:
vadym 2020-08-05 14:42:13 -07:00
parent 445683b87e
commit 53c945430d

View File

@ -128,7 +128,7 @@ class YggdrasilTunService : VpnService() {
val job = SupervisorJob()
scope = CoroutineScope(Dispatchers.Default + job)
scope!!.launch {
val buffer = ByteArray(1024)
val buffer = ByteArray(MAX_PACKET_SIZE)
while (!isClosed) {
readPacketsFromTun(yggConduitEndpoint, buffer)
}
@ -215,7 +215,7 @@ class YggdrasilTunService : VpnService() {
private fun readPacketsFromTun(yggConduitEndpoint: ConduitEndpoint, buffer: ByteArray) {
try {
// Read the outgoing packet from the input stream.
val length = tunInputStream.buffered().read(buffer)
val length = tunInputStream.read(buffer)
if(length>0) {
yggConduitEndpoint.send(buffer.sliceArray(IntRange(0, length - 1)))
}