From f4d69464402d80ca5902283d34e34e0ffb86bbd5 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Tue, 8 Oct 2024 13:17:36 +0900 Subject: [PATCH] Rename queryCount -> queryIndex queryCount was "the count of queries until now, excluding this one", which isn't as clear as "queryIndex" (especially in calculations). queryIndex is a more usual way to name something that starts at 0 and increases by one with each instance. Test: atest Change-Id: Id763decf7d2db7462c296955d6123cb1b14585fe --- .../server/connectivity/mdns/QueryTaskConfig.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java b/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java index 1e53d15964..4e74159816 100644 --- a/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java +++ b/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java @@ -57,9 +57,9 @@ public class QueryTaskConfig { private final int burstCounter; final long delayBeforeTaskWithoutBackoffMs; private final boolean isFirstBurst; - private final long queryCount; + private final long queryIndex; - QueryTaskConfig(long queryCount, int transactionId, + QueryTaskConfig(long queryIndex, int transactionId, boolean expectUnicastResponse, boolean isFirstBurst, int burstCounter, int queriesPerBurst, int timeBetweenBurstsInMs, long delayBeforeTaskWithoutBackoffMs) { @@ -70,7 +70,7 @@ public class QueryTaskConfig { this.burstCounter = burstCounter; this.delayBeforeTaskWithoutBackoffMs = delayBeforeTaskWithoutBackoffMs; this.isFirstBurst = isFirstBurst; - this.queryCount = queryCount; + this.queryIndex = queryIndex; } QueryTaskConfig(int queryMode) { @@ -98,7 +98,7 @@ public class QueryTaskConfig { this.timeBetweenBurstsInMs = INITIAL_TIME_BETWEEN_BURSTS_MS; this.delayBeforeTaskWithoutBackoffMs = TIME_BETWEEN_QUERIES_IN_BURST_MS; } - this.queryCount = 0; + this.queryIndex = 0; } long getDelayBeforeNextTaskWithoutBackoff(boolean isFirstQueryInBurst, @@ -137,7 +137,7 @@ public class QueryTaskConfig { * Get new QueryTaskConfig for next run. */ public QueryTaskConfig getConfigForNextRun(int queryMode) { - long newQueryCount = queryCount + 1; + long newQueryCount = queryIndex + 1; int newTransactionId = transactionId + 1; if (newTransactionId > UNSIGNED_SHORT_MAX_VALUE) { newTransactionId = 1; @@ -174,6 +174,6 @@ public class QueryTaskConfig { if (burstCounter != 0 || isFirstBurst) { return false; } - return queryCount > numOfQueriesBeforeBackoff; + return queryIndex > numOfQueriesBeforeBackoff; } }