From 754dca90ef464c24c1dd08771a4d9bd7eba7205a Mon Sep 17 00:00:00 2001 From: vadym Date: Mon, 15 Jun 2020 13:38:14 -0700 Subject: [PATCH] 1. fixed buffer overhead --- .../yggdrasil/YggdrasilTunService.kt | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt index 884ae48..f15bfae 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt @@ -87,22 +87,6 @@ class YggdrasilTunService : VpnService() { pi.send(this, MainActivity.STATUS_FINISH, intent) } - private fun getNonVpnNetworks(Address: String): Array { - val cm = - getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - val networks = cm.allNetworks - for (network in networks) { - val linkProperties = cm.getLinkProperties(network) - val addresses = linkProperties.linkAddresses - for (addr in addresses) { - if (addr.toString().startsWith(Address)) { - return arrayOf(network) - } - } - } - return emptyArray() - } - private fun fixConfig(config: MutableMap): MutableMap { val peers = arrayListOf(); peers.add("tcp://194.177.21.156:5066") @@ -139,7 +123,7 @@ class YggdrasilTunService : VpnService() { private fun readPacketsFromTun() { if(tunInputStream != null) { - var packet: ByteArray = ByteArray(MAX_PACKET_SIZE) + var packet = ByteArray(2048) // Read the outgoing packet from the input stream. var length = tunInputStream!!.read(packet)