code review
This commit is contained in:
parent
286a5081ff
commit
6fe77eba72
@ -90,7 +90,7 @@ class KeyShareTests : InstrumentedTest {
|
|||||||
mTestHelper.retryPeriodicallyWithLatch(waitLatch) {
|
mTestHelper.retryPeriodicallyWithLatch(waitLatch) {
|
||||||
aliceSession2.cryptoService().getOutgoingRoomKeyRequest()
|
aliceSession2.cryptoService().getOutgoingRoomKeyRequest()
|
||||||
.filter { req ->
|
.filter { req ->
|
||||||
// filter out request thwat was known before
|
// filter out request that was known before
|
||||||
!outgoingRequestBefore.any { req.requestId == it.requestId }
|
!outgoingRequestBefore.any { req.requestId == it.requestId }
|
||||||
}
|
}
|
||||||
.let {
|
.let {
|
||||||
|
@ -455,7 +455,7 @@ internal class DefaultVerificationService @Inject constructor(
|
|||||||
startReq: ValidVerificationInfoStart,
|
startReq: ValidVerificationInfoStart,
|
||||||
txConfigure: (DefaultVerificationTransaction) -> Unit): CancelCode? {
|
txConfigure: (DefaultVerificationTransaction) -> Unit): CancelCode? {
|
||||||
Timber.d("## SAS onStartRequestReceived ${startReq.transactionId}")
|
Timber.d("## SAS onStartRequestReceived ${startReq.transactionId}")
|
||||||
if (checkKeysAreDownloaded(otherUserId!!, startReq.fromDevice) != null) {
|
if (otherUserId?.let { checkKeysAreDownloaded(it, startReq.fromDevice) } != null) {
|
||||||
val tid = startReq.transactionId
|
val tid = startReq.transactionId
|
||||||
var existing = getExistingTransaction(otherUserId, tid)
|
var existing = getExistingTransaction(otherUserId, tid)
|
||||||
|
|
||||||
@ -469,15 +469,15 @@ internal class DefaultVerificationService @Inject constructor(
|
|||||||
if (existing != null && !existing.isIncoming) {
|
if (existing != null && !existing.isIncoming) {
|
||||||
val readyRequest = getExistingVerificationRequest(otherUserId, tid)
|
val readyRequest = getExistingVerificationRequest(otherUserId, tid)
|
||||||
if (readyRequest?.isReady == true) {
|
if (readyRequest?.isReady == true) {
|
||||||
if (isOtherPrioritary(otherUserId, existing.otherDeviceId ?: "")) {
|
if (isOtherPrioritary(otherUserId, existing.otherDeviceId ?: "")) {
|
||||||
// The other is prioritary!
|
// The other is prioritary!
|
||||||
// I should replace my outgoing with an incoming
|
// I should replace my outgoing with an incoming
|
||||||
removeTransaction(otherUserId, tid)
|
removeTransaction(otherUserId, tid)
|
||||||
existing = null
|
existing = null
|
||||||
} else {
|
} else {
|
||||||
// i am prioritary, ignore this start event!
|
// i am prioritary, ignore this start event!
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +554,7 @@ internal class DefaultVerificationService @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isOtherPrioritary(otherUserId: String, otherDeviceId: String) : Boolean {
|
private fun isOtherPrioritary(otherUserId: String, otherDeviceId: String): Boolean {
|
||||||
if (userId < otherUserId) {
|
if (userId < otherUserId) {
|
||||||
return false
|
return false
|
||||||
} else if (userId > otherUserId) {
|
} else if (userId > otherUserId) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user