Skip to content

Commit 69e109e

Browse files
committed
fix(ping): always set transmitted count regardless of ping success
When all pings fail (timeout -> Icmp.PingResult.Failed), rttList stays empty and stats.transmitted was never assigned, leaving it at 0. Move stats.transmitted = count before the rttList.isNotEmpty() check so it always reflects the number of attempted pings, matching the expected semantics of "packets transmitted". This unblocks HandshakeRestartHandler.awaitPingFailures() (introduced in #1182) which requires transmitted > 0 to distinguish a real failure from pings not routed through the tunnel.
1 parent b39a60d commit 69e109e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • app/src/main/java/com/zaneschepke/wireguardautotunnel/util/network

app/src/main/java/com/zaneschepke/wireguardautotunnel/util/network/NetworkUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class NetworkUtils(private val ioDispatcher: CoroutineDispatcher) {
6262
}
6363
.collect()
6464

65+
stats.transmitted = count
6566
if (rttList.isNotEmpty()) {
66-
stats.transmitted = count
6767
stats.received = received
6868
stats.packetLoss = ((count - received).toDouble().round(2) / count) * 100
6969
stats.rttMin = rttList.minOrNull()?.round(2) ?: 0.0

0 commit comments

Comments
 (0)