mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-04 18:02:55 +01:00
Respect bounds for heartbeat intervals when learning from timeouts
Without this it can happen that we learn the interval too close to 0 which causes us to assume that we are always disconnected breaking Mcs network functionality Change-Id: I0dee59d1365a8e10941dd346bfcd7af19d79d523
This commit is contained in:
parent
00a06d4b94
commit
222b03f7ee
@ -125,13 +125,16 @@ data class GcmPrefs(
|
||||
Log.d("GmsGcmPrefs", "learnTimeout: $pref")
|
||||
when (pref) {
|
||||
PREF_NETWORK_MOBILE, PREF_NETWORK_ROAMING -> setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_MOBILE, (learntMobileInterval * 0.95).toInt())
|
||||
val newInterval = (learntMobileInterval * 0.95).toInt()
|
||||
put(Gcm.LEARNT_MOBILE, max(MIN_INTERVAL, min(newInterval, MAX_INTERVAL)))
|
||||
}
|
||||
PREF_NETWORK_WIFI -> setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_WIFI, (learntWifiInterval * 0.95).toInt())
|
||||
val newInterval = (learntWifiInterval * 0.95).toInt()
|
||||
put(Gcm.LEARNT_WIFI, max(MIN_INTERVAL, min(newInterval, MAX_INTERVAL)))
|
||||
}
|
||||
else -> setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_OTHER, (learntOtherInterval * 0.95).toInt())
|
||||
val newInterval = (learntOtherInterval * 0.95).toInt()
|
||||
put(Gcm.LEARNT_OTHER, max(MIN_INTERVAL, min(newInterval, MAX_INTERVAL)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user