Rename available/unavailable states.

This commit is contained in:
akwizgran
2020-01-16 09:58:12 +00:00
parent 341382cfa8
commit 0259c23cb4
10 changed files with 47 additions and 50 deletions

View File

@@ -33,8 +33,8 @@ import static android.os.Build.VERSION.SDK_INT;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.bramble.api.plugin.Plugin.State.AVAILABLE;
import static org.briarproject.bramble.api.plugin.Plugin.State.UNAVAILABLE;
import static org.briarproject.bramble.api.plugin.Plugin.State.ACTIVE;
import static org.briarproject.bramble.api.plugin.Plugin.State.INACTIVE;
@NotNullByDefault
class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
@@ -133,7 +133,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
private void updateConnectionStatus() {
connectionStatusExecutor.execute(() -> {
State state = getState();
if (state != AVAILABLE && state != UNAVAILABLE) return;
if (state != ACTIVE && state != INACTIVE) return;
List<InetAddress> addrs = getLocalInetAddresses();
if (addrs.contains(WIFI_AP_ADDRESS)
|| addrs.contains(WIFI_DIRECT_AP_ADDRESS)) {
@@ -143,7 +143,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
// make outgoing connections on API 21+ if another network
// has internet access
socketFactory = SocketFactory.getDefault();
if (state == UNAVAILABLE) bind();
if (state == INACTIVE) bind();
} else if (addrs.isEmpty()) {
LOG.info("Not connected to wifi");
socketFactory = SocketFactory.getDefault();
@@ -151,7 +151,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
} else {
LOG.info("Connected to wifi");
socketFactory = getSocketFactory();
if (state == UNAVAILABLE) bind();
if (state == INACTIVE) bind();
}
});
}