Don't try to make multiple Bluetooth connections on Motorola devices.

This commit is contained in:
akwizgran
2020-10-30 17:00:58 +00:00
parent 01a146ba71
commit 027329ddd6
9 changed files with 78 additions and 13 deletions

View File

@@ -22,6 +22,8 @@ public abstract class AbstractDuplexTransportConnection
private final Writer writer;
private final AtomicBoolean halfClosed, closed;
private volatile boolean markedForClose = false;
protected AbstractDuplexTransportConnection(Plugin plugin) {
this.plugin = plugin;
reader = new Reader();
@@ -52,6 +54,16 @@ public abstract class AbstractDuplexTransportConnection
return remote;
}
@Override
public boolean isMarkedForClose() {
return markedForClose;
}
@Override
public void markForClose() {
markedForClose = true;
}
private class Reader implements TransportConnectionReader {
@Override

View File

@@ -1,6 +1,7 @@
package org.briarproject.bramble.api.plugin.duplex;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.plugin.ConnectionHandler;
import org.briarproject.bramble.api.plugin.TransportConnectionReader;
import org.briarproject.bramble.api.plugin.TransportConnectionWriter;
import org.briarproject.bramble.api.properties.TransportProperties;
@@ -30,4 +31,17 @@ public interface DuplexTransportConnection {
* the remote peer.
*/
TransportProperties getRemoteProperties();
/**
* Returns true if the connection should be closed immediately without
* sending anything.
*/
boolean isMarkedForClose();
/**
* Call this method before the connection is passed to its
* {@link ConnectionHandler} if the connection should be closed immediately
* without sending anything.
*/
void markForClose();
}