mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-27 00:51:44 +01:00
Try to fix race condition when re-connecting
(Count down latch only if services have been discovered)
This commit is contained in:
parent
21eada4caa
commit
f0e8440e67
@ -265,9 +265,6 @@ public final class BtLEQueue {
|
|||||||
|
|
||||||
mGbDevice.setState(newState);
|
mGbDevice.setState(newState);
|
||||||
mGbDevice.sendDeviceUpdateIntent(mContext);
|
mGbDevice.sendDeviceUpdateIntent(mContext);
|
||||||
if (mConnectionLatch != null && newState == State.CONNECTED) {
|
|
||||||
mConnectionLatch.countDown();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect() {
|
public void disconnect() {
|
||||||
@ -516,6 +513,9 @@ public final class BtLEQueue {
|
|||||||
// only propagate the successful event
|
// only propagate the successful event
|
||||||
getCallbackToUse().onServicesDiscovered(gatt);
|
getCallbackToUse().onServicesDiscovered(gatt);
|
||||||
}
|
}
|
||||||
|
if (mConnectionLatch != null) {
|
||||||
|
mConnectionLatch.countDown();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("onServicesDiscovered received: " + status);
|
LOG.warn("onServicesDiscovered received: " + status);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user