Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit 6011765

Browse files
committed
implement method for adding DormantClientTimeout config option to the torrc file
1 parent 260d3af commit 6011765

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

topl-core/src/main/java/io/matthewnelson/topl_core/settings/TorSettingsBuilder.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,27 @@ class TorSettingsBuilder internal constructor(
318318
else
319319
this
320320

321+
fun dormantClientTimetout(minutes: Int): TorSettingsBuilder {
322+
val value = if (minutes < 10)
323+
10
324+
else
325+
minutes
326+
buffer.append("DormantClientTimeout $value minutes\n")
327+
return this
328+
}
329+
330+
@SettingsConfig
331+
fun dormantClientTimeoutFromSettings(): TorSettingsBuilder {
332+
return when (val minutes = torSettings.dormantClientTimeout) {
333+
null -> {
334+
this
335+
}
336+
else -> {
337+
dormantClientTimetout(minutes)
338+
}
339+
}
340+
}
341+
321342
fun disableNetwork(disable: Boolean): TorSettingsBuilder {
322343
val disableNetwork = if (disable) "1" else "0"
323344
buffer.append("DisableNetwork $disableNetwork\n")

0 commit comments

Comments
 (0)