diff --git a/app/build.gradle b/app/build.gradle index ae2661a..854ae6a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "eu.neilalexander.yggdrasil" minSdkVersion 21 targetSdkVersion 29 - versionCode 12 - versionName "0.1-012" + versionCode 13 + versionName "0.1-013" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/eu/neilalexander/yggdrasil/PacketTunnelProvider.kt b/app/src/main/java/eu/neilalexander/yggdrasil/PacketTunnelProvider.kt index 4e7067e..36d3b56 100644 --- a/app/src/main/java/eu/neilalexander/yggdrasil/PacketTunnelProvider.kt +++ b/app/src/main/java/eu/neilalexander/yggdrasil/PacketTunnelProvider.kt @@ -282,9 +282,11 @@ open class PacketTunnelProvider: VpnService() { val writerStream = writerStream val writerThread = writerThread if (writerThread == null || writerStream == null) { + Log.i(TAG, "Write thread or stream is null") break@writes } if (Thread.currentThread().isInterrupted || !writerStream.fd.valid()) { + Log.i(TAG, "Write thread interrupted or file descriptor is invalid") break@writes } try { @@ -293,6 +295,12 @@ open class PacketTunnelProvider: VpnService() { writerStream.write(buf, 0, len.toInt()) } } catch (e: Exception) { + Log.i(TAG, "Error in write: $e") + if (e.toString().contains("ENOBUFS")) { + //TODO Check this by some error code + //More info about this: https://github.com/AdguardTeam/AdguardForAndroid/issues/724 + continue + } break@writes } } @@ -308,15 +316,18 @@ open class PacketTunnelProvider: VpnService() { val readerStream = readerStream val readerThread = readerThread if (readerThread == null || readerStream == null) { + Log.i(TAG, "Read thread or stream is null") break@reads } if (Thread.currentThread().isInterrupted ||!readerStream.fd.valid()) { + Log.i(TAG, "Read thread interrupted or file descriptor is invalid") break@reads } try { val n = readerStream.read(b) yggdrasil.sendBuffer(b, n.toLong()) } catch (e: Exception) { + Log.i(TAG, "Error in sendBuffer: $e") break@reads } }