tracks and displays connection tentatives on relay settings

This commit is contained in:
Vitor Pamplona
2026-03-11 08:42:32 -04:00
parent ca9074e6f5
commit 71574a5ce0
4 changed files with 29 additions and 3 deletions
@@ -32,6 +32,8 @@ class RelayStat(
var errorCounter: Int = 0,
var pingInMs: Int = 0,
var compression: Boolean = false,
var connectionTentatives: Int = 0,
var connectionCompleted: Int = 0,
) {
val messages = LruCache<IRelayDebugMessage, IRelayDebugMessage>(100)
@@ -63,6 +65,14 @@ class RelayStat(
sentBytes += bytesUsedInMemory
}
fun newConnection() {
connectionTentatives++
}
fun connectionCompleted() {
connectionCompleted++
}
fun newSpam(
link1: String,
link2: String,
@@ -46,6 +46,13 @@ class RelayStats(
private val clientListener =
object : IRelayClientListener {
override fun onConnecting(relay: IRelayClient) {
super.onConnecting(relay)
with(get(relay.url)) {
newConnection()
}
}
override fun onConnected(
relay: IRelayClient,
pingMillis: Int,
@@ -54,6 +61,7 @@ class RelayStats(
with(get(relay.url)) {
pingInMs = pingMillis
compression = compressed
connectionCompleted()
}
}