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

Commit 800ff3a

Browse files
committed
connect additional listeners up from both sides to TorService
1 parent f2e05eb commit 800ff3a

File tree

1 file changed

+19
-13
lines changed
  • topl-service/src/main/java/io/matthewnelson/topl_service/service

1 file changed

+19
-13
lines changed

topl-service/src/main/java/io/matthewnelson/topl_service/service/TorService.kt

+19-13
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,32 @@ import io.matthewnelson.topl_service.onionproxy.OnionProxyEventBroadcaster
1616
import io.matthewnelson.topl_service.onionproxy.OnionProxyEventListener
1717
import io.matthewnelson.topl_service.onionproxy.OnionProxyInstaller
1818
import io.matthewnelson.topl_service.service.ActionConsts.ServiceAction
19+
import net.freehaven.tor.control.EventListener
1920

2021
internal class TorService: Service() {
2122

2223
companion object {
2324
private lateinit var torConfigFiles: TorConfigFiles
2425
private lateinit var torSettings: TorSettings
25-
private var buildConfigVersion: Int = -1
26+
private var additionalEventListener: EventListener? = null
27+
private var buildConfigVersionCode: Int = -1
2628
private lateinit var geoipAssetPath: String
2729
private lateinit var geoip6AssetPath: String
2830

2931
fun initialize(
30-
config: TorConfigFiles,
31-
settings: TorSettings,
32-
buildVersion: Int,
33-
geoipPath: String,
34-
geoip6Path: String
32+
torConfigFiles: TorConfigFiles,
33+
torSettings: TorSettings,
34+
additionalEventListener: EventListener?,
35+
buildConfigVersionCode: Int,
36+
geoipAssetPath: String,
37+
geoip6AssetPath: String
3538
) {
36-
torConfigFiles = config
37-
torSettings = settings
38-
buildConfigVersion = buildVersion
39-
geoipAssetPath = geoipPath
40-
geoip6AssetPath = geoip6Path
39+
this.torConfigFiles = torConfigFiles
40+
this.torSettings = torSettings
41+
this.additionalEventListener = additionalEventListener
42+
this.buildConfigVersionCode = buildConfigVersionCode
43+
this.geoipAssetPath = geoipAssetPath
44+
this.geoip6AssetPath = geoip6AssetPath
4145
}
4246

4347
// Intents/LocalBroadcastManager
@@ -59,7 +63,7 @@ internal class TorService: Service() {
5963
val onionProxyInstaller = OnionProxyInstaller(
6064
this,
6165
torConfigFiles,
62-
buildConfigVersion,
66+
buildConfigVersionCode,
6367
geoipAssetPath,
6468
geoip6AssetPath
6569
)
@@ -69,11 +73,13 @@ internal class TorService: Service() {
6973
torServiceSettings
7074
)
7175
val onionProxyEventBroadcaster = OnionProxyEventBroadcaster(this, torServiceSettings)
76+
val onionProxyEventListener = OnionProxyEventListener(this, onionProxyEventBroadcaster)
7277
onionProxyManager = OnionProxyManager(
7378
this,
7479
onionProxyContext,
7580
onionProxyEventBroadcaster,
76-
OnionProxyEventListener(this, onionProxyEventBroadcaster)
81+
onionProxyEventListener,
82+
arrayOf(additionalEventListener)
7783
)
7884
onionProxyManager.setup()
7985
}

0 commit comments

Comments
 (0)