From b48b39d94c4a209abc55b4fdc7fdcff6ad6b38c0 Mon Sep 17 00:00:00 2001 From: vadym Date: Mon, 15 Jun 2020 14:12:23 -0700 Subject: [PATCH] 1. fixed battery high consumption --- .../io/github/chronosx88/yggdrasil/YggdrasilTunService.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 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 f15bfae..28024b8 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt @@ -1,10 +1,7 @@ package io.github.chronosx88.yggdrasil import android.app.PendingIntent -import android.content.Context import android.content.Intent -import android.net.ConnectivityManager -import android.net.Network import android.net.VpnService import android.os.ParcelFileDescriptor import android.system.OsConstants @@ -126,13 +123,12 @@ class YggdrasilTunService : VpnService() { var packet = ByteArray(2048) // Read the outgoing packet from the input stream. var length = tunInputStream!!.read(packet) - if (length > 0) { var buffer = ByteBuffer.allocate(length); buffer.put(packet, 0, length) - buffer.limit(length) yggConduitEndpoint.send(buffer.array()) - + } else { + Thread.sleep(10) } } }