Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Apr 27, 2022
1 parent 728faae commit 8920ed3
Show file tree
Hide file tree
Showing 14 changed files with 1,797 additions and 1,865 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ class KeyShareTests : InstrumentedTest {
.markedLocallyAsManuallyVerified(aliceNewSession.myUserId, aliceNewSession.sessionParams.deviceId!!)

// /!\ Stop initial alice session syncing so that it can't reply
aliceSession.cryptoService().enableKeyGossiping(false)
aliceSession.stopSync()

// Let's now try to request
Expand All @@ -440,6 +441,7 @@ class KeyShareTests : InstrumentedTest {
// Should get a reply from bob and not from alice
commonTestHelper.waitWithLatch { latch ->
commonTestHelper.retryPeriodicallyWithLatch(latch) {
// Log.d("#TEST", "outgoing key requests :${aliceNewSession.cryptoService().getOutgoingRoomKeyRequests().joinToString { it.sessionId ?: "?" }}")
val outgoing = aliceNewSession.cryptoService().getOutgoingRoomKeyRequests().firstOrNull { it.sessionId == sentEventMegolmSession }
val bobReply = outgoing?.results?.firstOrNull { it.userId == bobSession.myUserId }
val result = bobReply?.result
Expand All @@ -453,6 +455,7 @@ class KeyShareTests : InstrumentedTest {
assertEquals("The request should not be canceled", OutgoingRoomKeyRequestState.SENT, outgoingReq.state)

// let's wake up alice
aliceSession.cryptoService().enableKeyGossiping(true)
aliceSession.startSync(true)

// We should now get a reply from first session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ data class MXCryptoConfig constructor(
* Currently megolm keys are requested to the sender device and to all of our devices.
* You can limit request only to your sessions by turning this setting to `true`
*/
val limitRoomKeyRequestsToMyDevices: Boolean = false
val limitRoomKeyRequestsToMyDevices: Boolean = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ internal class DefaultCryptoService @Inject constructor(
*/
override fun removeRoomKeysRequestListener(listener: GossipingRequestListener) {
incomingKeyRequestManager.removeRoomKeysRequestListener(listener)
secretShareManager.addListener(listener)
secretShareManager.removeListener(listener)
}

/**
Expand Down
Loading

0 comments on commit 8920ed3

Please sign in to comment.