diff --git a/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java b/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java index e784b5a88f4f89d86a21c69136a0fd8cc8e10172..75d42231d14a157cc4299d5e688161ea05e3c579 100644 --- a/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java +++ b/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java @@ -146,11 +146,14 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin { // Try to make the device discoverable (requires root on Linux) try { localDevice.setDiscoverable(DiscoveryAgent.GIAC); + } catch(BluetoothStateException e) { + if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage()); + } + // Advertise the address to contacts if the device is discoverable + if(localDevice.getDiscoverable() == DiscoveryAgent.GIAC) { TransportProperties p = callback.getLocalProperties(); p.put("address", localDevice.getBluetoothAddress()); callback.setLocalProperties(p); - } catch(BluetoothStateException e) { - if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage()); } }