Always cancel eventSource
This commit is contained in:
parent
af866e3a14
commit
adcf14e499
|
@ -18,6 +18,10 @@ object FailureHandler {
|
||||||
|
|
||||||
// This is the last eventSource opened
|
// This is the last eventSource opened
|
||||||
private var eventSource: EventSource? = null
|
private var eventSource: EventSource? = null
|
||||||
|
set(value) {
|
||||||
|
field?.cancel()
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
|
||||||
fun newEventSource(context: Context, eventSource: EventSource) {
|
fun newEventSource(context: Context, eventSource: EventSource) {
|
||||||
Log.d(TAG, "newEvent/Eventsource: $eventSource")
|
Log.d(TAG, "newEvent/Eventsource: $eventSource")
|
||||||
|
@ -48,6 +52,8 @@ object FailureHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.eventSource = null
|
this.eventSource = null
|
||||||
|
} else {
|
||||||
|
eventSource?.cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +65,8 @@ object FailureHandler {
|
||||||
Log.d(TAG, "EventSource is known or null")
|
Log.d(TAG, "EventSource is known or null")
|
||||||
nFails = 1
|
nFails = 1
|
||||||
this.eventSource = null
|
this.eventSource = null
|
||||||
|
} else {
|
||||||
|
eventSource?.cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue