Skip to content

Commit

Permalink
Notifies relay failures after marking them as closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Aug 2, 2024
1 parent b02fa43 commit fd06193
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ammolite/src/main/java/com/vitorpamplona/ammolite/relays/Relay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,20 @@ class Relay(
// checks if this is an actual failure. Closing the socket generates an onFailure as well.
if (!(socket == null && (t.message == "Socket is closed" || t.message == "Socket closed"))) {
RelayStats.newError(url, response?.message ?: t.message)

Log.w("Relay", "Relay onFailure $url, ${response?.message} $response ${t.message} $socket")
t.printStackTrace()
listeners.forEach {
it.onError(
this@Relay,
"",
Error("WebSocket Failure. Response: $response. Exception: ${t.message}", t),
)
}
}

// Failures disconnect the relay.
markConnectionAsClosed()

Log.w("Relay", "Relay onFailure $url, ${response?.message} $response ${t.message} $socket")
t.printStackTrace()
listeners.forEach {
it.onError(
this@Relay,
"",
Error("WebSocket Failure. Response: $response. Exception: ${t.message}", t),
)
}
}
}

Expand Down

0 comments on commit fd06193

Please sign in to comment.