refactor: remove unused lastLogTime from TorService
Dead code from the earlier callbackFlow version that had a bootstrap stall monitor. No longer needed with the MutableStateFlow design. https://claude.ai/code/session_01BApgDd5udqBzMqysSRMpZu
This commit is contained in:
@@ -34,7 +34,6 @@ import kotlinx.coroutines.sync.Mutex
|
|||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
|
||||||
|
|
||||||
private const val DEFAULT_SOCKS_PORT = 19050
|
private const val DEFAULT_SOCKS_PORT = 19050
|
||||||
private const val MAX_PORT_RETRIES = 3
|
private const val MAX_PORT_RETRIES = 3
|
||||||
@@ -59,7 +58,6 @@ class TorService(
|
|||||||
private var artiProxy: ArtiProxy? = null
|
private var artiProxy: ArtiProxy? = null
|
||||||
private var currentPort: Int = DEFAULT_SOCKS_PORT
|
private var currentPort: Int = DEFAULT_SOCKS_PORT
|
||||||
private val bootstrapped = AtomicBoolean(false)
|
private val bootstrapped = AtomicBoolean(false)
|
||||||
private val lastLogTime = AtomicLong(0L)
|
|
||||||
|
|
||||||
private val _status = MutableStateFlow<TorServiceStatus>(TorServiceStatus.Off)
|
private val _status = MutableStateFlow<TorServiceStatus>(TorServiceStatus.Off)
|
||||||
val status: StateFlow<TorServiceStatus> = _status.asStateFlow()
|
val status: StateFlow<TorServiceStatus> = _status.asStateFlow()
|
||||||
@@ -68,7 +66,6 @@ class TorService(
|
|||||||
ArtiLogListener { logLine ->
|
ArtiLogListener { logLine ->
|
||||||
val text = logLine ?: return@ArtiLogListener
|
val text = logLine ?: return@ArtiLogListener
|
||||||
Log.d("TorService") { "Arti: $text" }
|
Log.d("TorService") { "Arti: $text" }
|
||||||
lastLogTime.set(System.currentTimeMillis())
|
|
||||||
|
|
||||||
when {
|
when {
|
||||||
text.contains("Sufficiently bootstrapped", ignoreCase = true) ||
|
text.contains("Sufficiently bootstrapped", ignoreCase = true) ||
|
||||||
@@ -113,7 +110,6 @@ class TorService(
|
|||||||
|
|
||||||
_status.value = TorServiceStatus.Connecting
|
_status.value = TorServiceStatus.Connecting
|
||||||
bootstrapped.set(false)
|
bootstrapped.set(false)
|
||||||
lastLogTime.set(System.currentTimeMillis())
|
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
var socksPort = DEFAULT_SOCKS_PORT
|
var socksPort = DEFAULT_SOCKS_PORT
|
||||||
|
|||||||
Reference in New Issue
Block a user