Should not crash app when StateSync fails to bind.

This commit is contained in:
Koen J 2024-12-06 17:49:18 +01:00
parent 4066ce73a8
commit 7c9e9d5f52

View File

@ -112,6 +112,7 @@ class StateSync {
Logger.i(TAG, "Sync key pair initialized (public key = ${publicKey})")
_thread = Thread {
try {
val serverSocket = ServerSocket(PORT)
_serverSocket = serverSocket
@ -125,6 +126,10 @@ class StateSync {
session.startAsResponder()
}
} catch (e: Throwable) {
Logger.e(TAG, "Failed to bind server socket to port ${PORT}", e)
UIDialogs.toast("Failed to start sync, port in use")
}
}.apply { start() }
if (Settings.instance.synchronization.connectLast) {