mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Try to fix race condition when re-connecting
(Count down latch only if services have been discovered)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user