Skip to content

Commit d30a418

Browse files
committed
feat(Logs): Show Home error when core logs report session busy restart due to full server capacity
1 parent 5a0bc17 commit d30a418

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

android/app/src/main/java/com/masterdns/vpn/service/MasterDnsVpnService.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ class MasterDnsVpnService : VpnService() {
6969
@Volatile
7070
private var socksAuthWarningShown = false
7171
@Volatile
72+
private var sessionBusyWarningShown = false
73+
@Volatile
7274
private var activeLocalSocksPort: Int = DEFAULT_SOCKS_PORT
7375

7476
override fun onCreate() {
@@ -98,6 +100,7 @@ class MasterDnsVpnService : VpnService() {
98100
VpnManager.updateState(VpnManager.VpnState.CONNECTING)
99101
VpnManager.clearError()
100102
socksAuthWarningShown = false
103+
sessionBusyWarningShown = false
101104

102105
// Show foreground notification
103106
startForeground(NOTIFICATION_ID, buildNotification(getString(R.string.notification_connecting)))
@@ -560,6 +563,7 @@ class MasterDnsVpnService : VpnService() {
560563
if (line.isNotBlank()) {
561564
VpnManager.appendCoreLog(line)
562565
maybeReportSocksAuthIssue(line)
566+
maybeReportSessionBusyIssue(line)
563567
}
564568
}
565569
pointer = raf.filePointer
@@ -585,6 +589,18 @@ class MasterDnsVpnService : VpnService() {
585589
VpnManager.setError(message)
586590
}
587591

592+
private fun maybeReportSessionBusyIssue(line: String) {
593+
if (sessionBusyWarningShown) return
594+
val normalized = line.uppercase()
595+
val isSessionBusy = normalized.contains("SESSION RESTART REQUESTED: SESSION BUSY RECEIVED")
596+
if (!isSessionBusy) return
597+
598+
sessionBusyWarningShown = true
599+
val message = "Server is busy and cannot accept new sessions at the moment."
600+
VpnManager.appendLog(message)
601+
VpnManager.setError(message)
602+
}
603+
588604
private fun acquireWakeLock() {
589605
if (wakeLock?.isHeld == true) return
590606
val pm = getSystemService(POWER_SERVICE) as? PowerManager ?: return
-333 KB
Binary file not shown.

0 commit comments

Comments
 (0)