Merge pull request #1978 from vector-im/feature/ttl

Improve #1971, especially be robust about system time change
This commit is contained in:
Benoit Marty 2020-08-21 18:12:35 +02:00 committed by GitHub
commit 20e2b3beb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@
package org.matrix.android.sdk.internal.session.call
import android.os.SystemClock
import org.matrix.android.sdk.api.MatrixCallback
import org.matrix.android.sdk.api.extensions.tryThis
import org.matrix.android.sdk.api.session.call.CallSignalingService
@ -59,10 +60,10 @@ internal class DefaultCallSignalingService @Inject constructor(
private val activeCalls = mutableListOf<MxCall>()
private val cachedTurnServerResponse = object {
// Keep one minute safe to avoid considering the data is valid and then actually it is not when effectively using it.
private val MIN_TTL = 60
private val now = { System.currentTimeMillis() / 1000 }
private val now = { SystemClock.elapsedRealtime() / 1000 }
private var expiresAt: Long = 0