Fixes the Tor leaks for relays and some image content.

This commit is contained in:
Vitor Pamplona
2025-01-04 17:35:34 -05:00
parent 8a8ae4fb8b
commit 6522d74253
3 changed files with 12 additions and 5 deletions

View File

@@ -132,7 +132,7 @@ class Relay(
lastConnectTentative = TimeUtils.now()
socket = socketBuilder.build(url, false, RelayListener(onConnected))
socket = socketBuilder.build(url, forceProxy, RelayListener(onConnected))
socket?.connect()
} catch (e: Exception) {
if (e is CancellationException) throw e

View File

@@ -91,7 +91,8 @@ class RelayPool : Relay.Listener {
fun loadRelays(relayList: List<Relay>) {
check(relayList.isNotEmpty()) { "Relay list should never be empty" }
relayList.forEach { addRelay(it) }
relayList.forEach { addRelayInner(it) }
updateStatus()
}
fun unloadRelays() {
@@ -142,9 +143,13 @@ class RelayPool : Relay.Listener {
}
fun addRelay(relay: Relay) {
addRelayInner(relay)
updateStatus()
}
private fun addRelayInner(relay: Relay) {
relay.register(this)
relays += relay
updateStatus()
}
fun removeRelay(relay: Relay) {