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

Commit 7004e69

Browse files
committed
extract setting of ports to null to a method
1 parent 96fb493 commit 7004e69

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

topl-service/src/main/java/io/matthewnelson/topl_service/service/components/onionproxy/ServiceEventBroadcaster.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ internal class ServiceEventBroadcaster(private val torService: BaseService): Eve
217217
@Volatile
218218
private var transPort: String? = null
219219

220+
private fun setAllPortsNull() {
221+
controlPort = null
222+
dnsPort = null
223+
httpTunnelPort = null
224+
socksPort = null
225+
transPort = null
226+
}
227+
220228
override fun broadcastNotice(msg: String) {
221229

222230
when {
@@ -401,11 +409,7 @@ internal class ServiceEventBroadcaster(private val torService: BaseService): Eve
401409
override fun broadcastTorState(@TorState state: String, @TorNetworkState networkState: String) {
402410
if (torState == TorState.ON && state != torState) {
403411
bootstrapProgress = ""
404-
controlPort = null
405-
dnsPort = null
406-
httpTunnelPort = null
407-
socksPort = null
408-
transPort = null
412+
setAllPortsNull()
409413
updateAppEventBroadcasterWithPortInfo()
410414
torService.removeNotificationActions()
411415
}

0 commit comments

Comments
 (0)