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

Commit ebc291c

Browse files
committed
add check on network state change for ports and broadcast them on disable/enable
1 parent 7004e69 commit ebc291c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,20 @@ internal class ServiceEventBroadcaster(private val torService: BaseService): Eve
421421
torState = state
422422

423423
if (networkState == TorNetworkState.DISABLED) {
424+
if (isBootstrappingComplete()) {
425+
setAllPortsNull()
426+
updateAppEventBroadcasterWithPortInfo()
427+
}
428+
424429
// Update torNetworkState _before_ setting the icon to `disabled` so bandwidth won't
425430
// overwrite the icon with an update
426431
torNetworkState = networkState
427432
torService.updateNotificationIcon(NotificationImage.DISABLED)
428433
} else {
429-
if (isBootstrappingComplete())
434+
if (isBootstrappingComplete()) {
435+
updateAppEventBroadcasterWithPortInfo()
430436
torService.updateNotificationIcon(NotificationImage.ENABLED)
437+
}
431438

432439
// Update torNetworkState _after_ setting the icon to `enabled` so bandwidth changes
433440
// occur afterwards and this won't overwrite ImageState.DATA

0 commit comments

Comments
 (0)