mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
Fix websocket reconnect race due to async IMO termination.
This commit is contained in:
@@ -252,7 +252,7 @@ class NetworkDependenciesModule(
|
||||
|
||||
fun closeConnections() {
|
||||
Log.i(TAG, "Closing connections.")
|
||||
incomingMessageObserver.terminateAsync()
|
||||
incomingMessageObserver.terminate()
|
||||
if (_signalServiceMessageSender.isInitialized()) {
|
||||
signalServiceMessageSender.cancelInFlightRequests()
|
||||
}
|
||||
|
||||
@@ -265,17 +265,13 @@ class IncomingMessageObserver(
|
||||
}
|
||||
}
|
||||
|
||||
fun terminateAsync() {
|
||||
Log.w(TAG, "Termination Enqueued! ${this.hashCode()}", Throwable())
|
||||
fun terminate() {
|
||||
Log.w(TAG, "Termination! ${this.hashCode()}", Throwable())
|
||||
INSTANCE_COUNT.decrementAndGet()
|
||||
networkConnectionListener.unregister()
|
||||
webSocketStateDisposable.dispose()
|
||||
SignalExecutors.BOUNDED.execute {
|
||||
Log.w(TAG, "Beginning termination. ${this.hashCode()}")
|
||||
terminated = true
|
||||
Log.w(TAG, "Disconnecting auth socket as part of termination")
|
||||
authWebSocket.disconnect()
|
||||
}
|
||||
terminated = true
|
||||
authWebSocket.disconnect()
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
Reference in New Issue
Block a user