Add fix + regression test for null disconnectReason in onConnectionInterrupted.

This commit is contained in:
andrew-signal
2025-02-11 15:31:06 -05:00
committed by Greyson Parrelli
parent bce4c347a1
commit 22bfafc317
2 changed files with 7 additions and 1 deletions
@@ -379,7 +379,7 @@ class LibSignalChatConnection(
incomingRequestQueue.put(incomingWebSocketRequest)
}
override fun onConnectionInterrupted(chat: ChatConnection, disconnectReason: ChatServiceException) {
override fun onConnectionInterrupted(chat: ChatConnection, disconnectReason: ChatServiceException?) {
CHAT_SERVICE_LOCK.withLock {
Log.i(TAG, "$name connection interrupted", disconnectReason)
chatConnection = null
@@ -69,6 +69,12 @@ class LibSignalChatConnectionTest {
delay {
it.complete(null)
disconnectLatch?.countDown()
// The disconnectReason is null when the disconnect is due to the local client requesting the disconnect.
// This is a regression test because we previously forgot to update the Kotlin type definitions to
// match this when the behavior changed in libsignal-client, causing NullPointerExceptions
// missed connection interrupted events.
chatListener!!.onConnectionInterrupted(chatConnection, null)
}
}