mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2025-01-22 16:06:30 +00:00
1. buffered read fix
This commit is contained in:
parent
b2b6f2c8ef
commit
445683b87e
@ -215,8 +215,10 @@ 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.read(buffer)
|
val length = tunInputStream.buffered().read(buffer)
|
||||||
|
if(length>0) {
|
||||||
yggConduitEndpoint.send(buffer.sliceArray(IntRange(0, length - 1)))
|
yggConduitEndpoint.send(buffer.sliceArray(IntRange(0, length - 1)))
|
||||||
|
}
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user