mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-12 05:49:30 +02:00
Marking relays with failure as not connected
This commit is contained in:
parent
dd35e01f8a
commit
625bbaf35c
@ -30,6 +30,7 @@ class Relay(
|
||||
}
|
||||
|
||||
fun requestAndWatch() {
|
||||
println("Connecting with ${url}")
|
||||
val request = Request.Builder().url(url).build()
|
||||
val listener = object : WebSocketListener() {
|
||||
|
||||
@ -87,6 +88,9 @@ class Relay(
|
||||
}
|
||||
|
||||
override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {
|
||||
// Failures disconnect the relay.
|
||||
socket = null
|
||||
//println("Relay onFailure ${url}, ${response?.message}")
|
||||
t.printStackTrace()
|
||||
listeners.forEach {
|
||||
it.onError(this@Relay, "", Error("WebSocket Failure. Response: ${response}. Exception: ${t.message}", t))
|
||||
@ -99,6 +103,7 @@ class Relay(
|
||||
fun disconnect() {
|
||||
//httpClient.dispatcher.executorService.shutdown()
|
||||
socket?.close(1000, "Normal close")
|
||||
socket = null
|
||||
}
|
||||
|
||||
fun sendFilter(requestId: String) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user