mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 08:09:12 +01:00
Fix session establishment in message processing benchmark tests.
This commit is contained in:
committed by
Michelle Tang
parent
a62f07db11
commit
501ef69f97
@@ -76,7 +76,7 @@ class BenchmarkCommandReceiver : BroadcastReceiver() {
|
||||
|
||||
runBlocking {
|
||||
launch(Dispatchers.IO) {
|
||||
Log.i(TAG, "Sending initial message form Bob to establish session.")
|
||||
Log.i(TAG, "Sending initial message from Bob to establish session.")
|
||||
BenchmarkWebSocketConnection.addPendingMessages(listOf(encryptedEnvelope.toWebSocketPayload()))
|
||||
BenchmarkWebSocketConnection.releaseMessages()
|
||||
|
||||
@@ -85,6 +85,10 @@ class BenchmarkCommandReceiver : BroadcastReceiver() {
|
||||
}
|
||||
}
|
||||
|
||||
// Complete the session handshake so both sides have a proper double-ratchet session
|
||||
Log.i(TAG, "Completing session handshake with reply.")
|
||||
client.completeSession()
|
||||
|
||||
// Have Bob generate N messages that will be received by Alice
|
||||
val messageCount = 500
|
||||
val envelopes = client.generateInboundEnvelopes(messageCount)
|
||||
@@ -103,7 +107,7 @@ class BenchmarkCommandReceiver : BroadcastReceiver() {
|
||||
|
||||
runBlocking {
|
||||
launch(Dispatchers.IO) {
|
||||
Log.i(TAG, "Sending initial group messages from client to establish sessions.")
|
||||
Log.i(TAG, "Sending initial group messages from clients to establish sessions.")
|
||||
BenchmarkWebSocketConnection.addPendingMessages(encryptedEnvelopes.map { it.toWebSocketPayload() })
|
||||
BenchmarkWebSocketConnection.releaseMessages()
|
||||
|
||||
@@ -112,6 +116,10 @@ class BenchmarkCommandReceiver : BroadcastReceiver() {
|
||||
}
|
||||
}
|
||||
|
||||
// Complete session handshakes so both sides have proper double-ratchet sessions
|
||||
Log.i(TAG, "Completing session handshakes with Alice replies.")
|
||||
clients.forEach { it.completeSession() }
|
||||
|
||||
// Have clients generate N group messages that will be received by Alice
|
||||
val allClientMessages = clients.map { client ->
|
||||
val messageCount = 100
|
||||
@@ -150,6 +158,9 @@ class BenchmarkCommandReceiver : BroadcastReceiver() {
|
||||
ThreadUtil.sleep(1000)
|
||||
}
|
||||
}
|
||||
|
||||
Log.i(TAG, "Completing session handshakes with Alice replies.")
|
||||
clients.forEach { it.completeSession() }
|
||||
}
|
||||
|
||||
private fun handleDeleteThread() {
|
||||
|
||||
Reference in New Issue
Block a user