1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-17 04:40:36 +02:00

Try to fix race condition when re-connecting

(Count down latch only if services have been discovered)
This commit is contained in:
Andreas Shimokawa 2019-12-26 00:18:36 +01:00
parent 21eada4caa
commit f0e8440e67

View File

@ -265,9 +265,6 @@ public final class BtLEQueue {
mGbDevice.setState(newState);
mGbDevice.sendDeviceUpdateIntent(mContext);
if (mConnectionLatch != null && newState == State.CONNECTED) {
mConnectionLatch.countDown();
}
}
public void disconnect() {
@ -516,6 +513,9 @@ public final class BtLEQueue {
// only propagate the successful event
getCallbackToUse().onServicesDiscovered(gatt);
}
if (mConnectionLatch != null) {
mConnectionLatch.countDown();
}
} else {
LOG.warn("onServicesDiscovered received: " + status);
}