aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-02-08 13:06:08 +0100
committerSven Gothel <[email protected]>2022-02-08 13:06:08 +0100
commita1ea89e5cd1d98b42e7a236160d83fd7104c9027 (patch)
tree1ab9f7f230427628afb0368419b4053dc728d018
parentf618578f53213a3e5599ffbe44a09a09b7d046e1 (diff)
DBTPeripheral00/DBTServer00: Issue device.remove() in processDisconnectedDevice(..)
device.remove() shall ensure to clear all device references from its BTAdapter to avoid leaks.
-rw-r--r--examples/java/DBTPeripheral00.java2
-rw-r--r--trial/java/trial/org/direct_bt/DBTServer00.java2
2 files changed, 4 insertions, 0 deletions
diff --git a/examples/java/DBTPeripheral00.java b/examples/java/DBTPeripheral00.java
index 8589258e..1de34acb 100644
--- a/examples/java/DBTPeripheral00.java
+++ b/examples/java/DBTPeripheral00.java
@@ -621,7 +621,9 @@ public class DBTPeripheral00 {
// already unpaired
stopAdvertising(device.getAdapter(), "device-disconnected");
+ device.remove();
BTDeviceRegistry.removeFromProcessingDevices(device.getAddressAndType());
+
try {
Thread.sleep(100); // wait a little (FIXME: Fast restart of advertising error)
} catch (final InterruptedException e) { }
diff --git a/trial/java/trial/org/direct_bt/DBTServer00.java b/trial/java/trial/org/direct_bt/DBTServer00.java
index 713504c5..5610efc1 100644
--- a/trial/java/trial/org/direct_bt/DBTServer00.java
+++ b/trial/java/trial/org/direct_bt/DBTServer00.java
@@ -659,7 +659,9 @@ public class DBTServer00 implements DBTServerTest {
BTUtils.println(System.err, "****** Disconnected Device (count "+(servedConnections.get()+1)+"): Start "+device.toString());
// already unpaired
+ device.remove();
BTDeviceRegistry.removeFromProcessingDevices(device.getAddressAndType());
+
try {
Thread.sleep(100); // wait a little (FIXME: Fast restart of advertising error)
} catch (final InterruptedException e) { }