From 8c9b7e4a01bbfc26e7368a0a3f8530e7ec744db7 Mon Sep 17 00:00:00 2001 From: Kr328 <39107975+Kr328@users.noreply.github.com> Date: Sat, 11 Apr 2020 19:49:20 +0800 Subject: [PATCH] decrease mtu --- .../main/java/com/github/kr328/clash/service/ClashService.kt | 2 +- .../main/java/com/github/kr328/clash/service/TunService.kt | 5 ++--- .../github/kr328/clash/service/clash/module/CloseModule.kt | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/service/src/main/java/com/github/kr328/clash/service/ClashService.kt b/service/src/main/java/com/github/kr328/clash/service/ClashService.kt index bda494a..f95eecb 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ClashService.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ClashService.kt @@ -45,7 +45,7 @@ class ClashService : BaseService() { } } runtime.install(CloseModule()) { - onClose { + onClosed { reason = null stopSelf() diff --git a/service/src/main/java/com/github/kr328/clash/service/TunService.kt b/service/src/main/java/com/github/kr328/clash/service/TunService.kt index 02b26d1..34b012d 100644 --- a/service/src/main/java/com/github/kr328/clash/service/TunService.kt +++ b/service/src/main/java/com/github/kr328/clash/service/TunService.kt @@ -15,7 +15,7 @@ import kotlinx.coroutines.launch class TunService : VpnService(), CoroutineScope by MainScope() { companion object { // from https://github.com/shadowsocks/shadowsocks-android/blob/master/core/src/main/java/com/github/shadowsocks/bg/VpnService.kt - private const val VPN_MTU = 65535 + private const val VPN_MTU = 9000 private const val PRIVATE_VLAN4_SUBNET = 30 private const val PRIVATE_VLAN4_CLIENT = "172.31.255.253" private const val PRIVATE_VLAN4_MIRROR = "172.31.255.254" @@ -57,7 +57,7 @@ class TunService : VpnService(), CoroutineScope by MainScope() { } } runtime.install(CloseModule()) { - onClose { + onClosed { launch { reason = null @@ -149,6 +149,5 @@ class TunService : VpnService(), CoroutineScope by MainScope() { settings.get(ServiceSettings.ACCESS_CONTROL_PACKAGES).toList() } else emptyList() } - } } \ No newline at end of file diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/CloseModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/CloseModule.kt index ffe121e..266efb5 100644 --- a/service/src/main/java/com/github/kr328/clash/service/clash/module/CloseModule.kt +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/CloseModule.kt @@ -9,7 +9,7 @@ class CloseModule : Module() { private var callback: () -> Unit = {} - fun onClose(cb: () -> Unit) { + fun onClosed(cb: () -> Unit) { callback = cb }