1. fixed battery high consumption

This commit is contained in:
vadym 2020-06-15 14:12:23 -07:00
parent 754dca90ef
commit b48b39d94c

View File

@ -1,10 +1,7 @@
package io.github.chronosx88.yggdrasil package io.github.chronosx88.yggdrasil
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.ConnectivityManager
import android.net.Network
import android.net.VpnService import android.net.VpnService
import android.os.ParcelFileDescriptor import android.os.ParcelFileDescriptor
import android.system.OsConstants import android.system.OsConstants
@ -126,13 +123,12 @@ class YggdrasilTunService : VpnService() {
var packet = ByteArray(2048) var packet = ByteArray(2048)
// Read the outgoing packet from the input stream. // Read the outgoing packet from the input stream.
var length = tunInputStream!!.read(packet) var length = tunInputStream!!.read(packet)
if (length > 0) { if (length > 0) {
var buffer = ByteBuffer.allocate(length); var buffer = ByteBuffer.allocate(length);
buffer.put(packet, 0, length) buffer.put(packet, 0, length)
buffer.limit(length)
yggConduitEndpoint.send(buffer.array()) yggConduitEndpoint.send(buffer.array())
} else {
Thread.sleep(10)
} }
} }
} }