Hide private variables

This commit is contained in:
Carter Jernigan 2023-01-30 14:47:10 -05:00
parent f089fb5424
commit b8be2a234f
2 changed files with 7 additions and 6 deletions

View File

@ -154,9 +154,9 @@ internal class BlockingLightWalletClientImpl private constructor(
channel = channelFactory.newChannel(lightWalletEndpoint) channel = channelFactory.newChannel(lightWalletEndpoint)
} }
// test code // These make the implementation of BlockingLightWalletClientImpl not thread-safe.
internal var stateCount = 0 private var stateCount = 0
internal var state: ConnectivityState? = null private var state: ConnectivityState? = null
private fun requireChannel(): ManagedChannel { private fun requireChannel(): ManagedChannel {
state = channel.getState(false).let { new -> state = channel.getState(false).let { new ->
if (state == new) stateCount++ else stateCount = 0 if (state == new) stateCount++ else stateCount = 0

View File

@ -154,9 +154,10 @@ internal class CoroutineLightWalletClientImpl private constructor(
channel = channelFactory.newChannel(lightWalletEndpoint) channel = channelFactory.newChannel(lightWalletEndpoint)
} }
// test code // These make the CoroutineLightWalletClientImpl not thread safe. In the long-term, we should
internal var stateCount = 0 // consider making it thread safe.
internal var state: ConnectivityState? = null private var stateCount = 0
private var state: ConnectivityState? = null
private fun requireChannel(): ManagedChannel { private fun requireChannel(): ManagedChannel {
state = channel.getState(false).let { new -> state = channel.getState(false).let { new ->
if (state == new) stateCount++ else stateCount = 0 if (state == new) stateCount++ else stateCount = 0