throw exception when connection fails
This commit is contained in:
parent
7a72cf2f19
commit
9a009d2f96
|
@ -203,7 +203,6 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
start = true,
|
||||
name = "ConnectionThread",
|
||||
) {
|
||||
// TODO quadruple check that we are not creating a party of Threads here
|
||||
try {
|
||||
val stop = CountDownLatch(1)
|
||||
stopConnecting = stop
|
||||
|
|
|
@ -127,6 +127,7 @@ class Connection(
|
|||
}
|
||||
|
||||
private fun waitForConnection(connectionWaitCond: ConnectionWaitCondition): ConnectionState {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "waitForConnection connectionWaitCond=$connectionWaitCond")
|
||||
try {
|
||||
connectionWaitCond.timeoutMs?.let {
|
||||
bleCommCallbacks.waitForConnection(it)
|
||||
|
@ -134,7 +135,7 @@ class Connection(
|
|||
connectionWaitCond.stopConnection?.let {
|
||||
while (!bleCommCallbacks.waitForConnection(STOP_CONNECTING_CHECK_INTERVAL_MS)) {
|
||||
if (it.count == 0L) {
|
||||
ConnectException("stopConnecting called")
|
||||
throw ConnectException("stopConnecting called")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue