throw exception when connection fails

This commit is contained in:
Andrei Vereha 2021-07-11 19:24:52 +02:00
parent 7a72cf2f19
commit 9a009d2f96
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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")
}
}
}