mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2024-11-13 22:11:03 +00:00
1. increased buffer size
This commit is contained in:
parent
445683b87e
commit
53c945430d
@ -128,7 +128,7 @@ class YggdrasilTunService : VpnService() {
|
|||||||
val job = SupervisorJob()
|
val job = SupervisorJob()
|
||||||
scope = CoroutineScope(Dispatchers.Default + job)
|
scope = CoroutineScope(Dispatchers.Default + job)
|
||||||
scope!!.launch {
|
scope!!.launch {
|
||||||
val buffer = ByteArray(1024)
|
val buffer = ByteArray(MAX_PACKET_SIZE)
|
||||||
while (!isClosed) {
|
while (!isClosed) {
|
||||||
readPacketsFromTun(yggConduitEndpoint, buffer)
|
readPacketsFromTun(yggConduitEndpoint, buffer)
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ class YggdrasilTunService : VpnService() {
|
|||||||
private fun readPacketsFromTun(yggConduitEndpoint: ConduitEndpoint, buffer: ByteArray) {
|
private fun readPacketsFromTun(yggConduitEndpoint: ConduitEndpoint, buffer: ByteArray) {
|
||||||
try {
|
try {
|
||||||
// Read the outgoing packet from the input stream.
|
// Read the outgoing packet from the input stream.
|
||||||
val length = tunInputStream.buffered().read(buffer)
|
val length = tunInputStream.read(buffer)
|
||||||
if(length>0) {
|
if(length>0) {
|
||||||
yggConduitEndpoint.send(buffer.sliceArray(IntRange(0, length - 1)))
|
yggConduitEndpoint.send(buffer.sliceArray(IntRange(0, length - 1)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user