mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2025-01-22 16:06:30 +00:00
1. fixed battery high consumption
This commit is contained in:
parent
754dca90ef
commit
b48b39d94c
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user