mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2025-01-22 16:06:30 +00:00
1. fixes possible IOxeption crash
This commit is contained in:
parent
fbc59cd863
commit
8890858011
@ -14,10 +14,7 @@ import kotlinx.coroutines.cancel
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import mobile.Mobile
|
import mobile.Mobile
|
||||||
import mobile.Yggdrasil
|
import mobile.Yggdrasil
|
||||||
import java.io.FileInputStream
|
import java.io.*
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.io.InputStream
|
|
||||||
import java.io.OutputStream
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
@ -75,9 +72,12 @@ class YggdrasilTunService : VpnService() {
|
|||||||
tunInputStream = FileInputStream(tunInterface!!.fileDescriptor)
|
tunInputStream = FileInputStream(tunInterface!!.fileDescriptor)
|
||||||
tunOutputStream = FileOutputStream(tunInterface!!.fileDescriptor)
|
tunOutputStream = FileOutputStream(tunInterface!!.fileDescriptor)
|
||||||
readCoroutine = GlobalScope.launch {
|
readCoroutine = GlobalScope.launch {
|
||||||
// FIXME it will throw exception (bad file descriptor) when coroutine will be canceled
|
|
||||||
while (true) {
|
while (true) {
|
||||||
readPacketsFromTun()
|
try{
|
||||||
|
readPacketsFromTun()
|
||||||
|
} catch (e: IOException){
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeCoroutine = GlobalScope.launch {
|
writeCoroutine = GlobalScope.launch {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user