@@ -302,22 +302,29 @@ class AutoConnectionManager(
302
302
}
303
303
304
304
private fun engageAutomaticMode () {
305
- listOfProtocols.sortBy {
306
- it.type
307
- }
308
- val disconnectedProtocolList =
309
- listOfProtocols.filter { it.type == ProtocolConnectionStatus .Disconnected }
310
- if (disconnectedProtocolList.isNotEmpty()) {
311
- disconnectedProtocolList[0 ].type = ProtocolConnectionStatus .NextUp
312
- disconnectedProtocolList[0 ].autoConnectTimeLeft = 10
313
- showConnectionFailureDialog(
314
- listOfProtocols,
315
- retry = { engageAutomaticMode() })
316
- } else {
317
- logger.debug(" Showing all protocol failed dialog." )
318
- lastKnownProtocolInformation = null
319
- reset()
320
- showAllProtocolFailedDialog()
305
+ synchronized(listOfProtocols) {
306
+ listOfProtocols.sortBy {
307
+ it.type
308
+ }
309
+
310
+ val disconnectedProtocolList =
311
+ listOfProtocols.filter { it.type == ProtocolConnectionStatus .Disconnected }
312
+
313
+ if (disconnectedProtocolList.isNotEmpty()) {
314
+ val first = disconnectedProtocolList[0 ]
315
+ first.type = ProtocolConnectionStatus .NextUp
316
+ first.autoConnectTimeLeft = 10
317
+
318
+ showConnectionFailureDialog(
319
+ listOfProtocols,
320
+ retry = { engageAutomaticMode() }
321
+ )
322
+ } else {
323
+ logger.debug(" Showing all protocol failed dialog." )
324
+ lastKnownProtocolInformation = null
325
+ reset()
326
+ showAllProtocolFailedDialog()
327
+ }
321
328
}
322
329
}
323
330
0 commit comments