Commit d1c2eb89 authored by Torsten Grote's avatar Torsten Grote

Merge branch '1712-fix-double-connection-counting' into 'master'

Don't count Bluetooth connections twice

See merge request !1245
parents 8fd9a40f e204d5a9
Pipeline #4369 passed with stage
in 9 minutes and 37 seconds
......@@ -227,9 +227,11 @@ abstract class BluetoothPlugin<SS> implements DuplexPlugin, EventListener {
if (LOG.isLoggable(INFO)) LOG.info(e.toString());
return;
}
backoff.reset();
if (connectionLimiter.contactConnectionOpened(conn))
LOG.info("Connection received");
if (connectionLimiter.contactConnectionOpened(conn)) {
backoff.reset();
callback.handleConnection(conn);
}
if (!running) return;
}
}
......@@ -273,13 +275,10 @@ abstract class BluetoothPlugin<SS> implements DuplexPlugin, EventListener {
String uuid = p.get(PROP_UUID);
if (isNullOrEmpty(uuid)) return;
ioExecutor.execute(() -> {
if (!isRunning() || !shouldAllowContactConnections()) return;
if (!connectionLimiter.canOpenContactConnection()) return;
DuplexTransportConnection d = createConnection(p);
if (d != null) {
backoff.reset();
if (connectionLimiter.contactConnectionOpened(d))
h.handleConnection(d);
h.handleConnection(d);
}
});
}
......@@ -325,7 +324,6 @@ abstract class BluetoothPlugin<SS> implements DuplexPlugin, EventListener {
if (isNullOrEmpty(uuid)) return null;
DuplexTransportConnection conn = connect(address, uuid);
if (conn == null) return null;
// TODO: Why don't we reset the backoff here?
return connectionLimiter.contactConnectionOpened(conn) ? conn : null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment