Commit 9b310d25 authored by Lisa (AI Assistant)'s avatar Lisa (AI Assistant)

Fix: Add retry logic to reconnect after connection failure

parent b3314ea8
...@@ -200,6 +200,16 @@ class NodeService : Service() { ...@@ -200,6 +200,16 @@ class NodeService : Service() {
Log.e(TAG, "Toast removed") Log.e(TAG, "Toast removed")
} else { } else {
Log.e(TAG, "Toast removed") Log.e(TAG, "Toast removed")
// Connection failed - retry after delay
Log.e(TAG, "Connection failed, scheduling retry in 3 seconds...")
scope.launch {
delay(3000)
if (ip.isNotBlank() && token.isNotBlank()) {
val fullUrl = if (protocol == "WSS") "wss://$ip:$port" else "ws://$ip:$port"
Log.e(TAG, "Retrying connection to: $fullUrl")
startNode(fullUrl, token, nodeId)
}
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment