[homekit] fix restarted on network interface change (#14226)
a regression caused during the final changes of #13877 Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
parent
f3ca3255a7
commit
0312e687ba
|
@ -87,7 +87,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||||
private final List<HomekitServer> homekitServers = new ArrayList<>();
|
private final List<HomekitServer> homekitServers = new ArrayList<>();
|
||||||
private final List<HomekitRoot> bridges = new ArrayList<>();
|
private final List<HomekitRoot> bridges = new ArrayList<>();
|
||||||
private MDNSClient mdnsClient;
|
private MDNSClient mdnsClient;
|
||||||
private int currentStartLevel = 0;
|
private boolean started = false;
|
||||||
|
|
||||||
private final List<HomekitChangeListener> changeListeners = new ArrayList<>();
|
private final List<HomekitChangeListener> changeListeners = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||||
clearStorage(i);
|
clearStorage(i);
|
||||||
}
|
}
|
||||||
stopHomekitServer();
|
stopHomekitServer();
|
||||||
if (currentStartLevel >= StartLevelService.STARTLEVEL_STATES) {
|
if (started) {
|
||||||
startHomekitServer();
|
startHomekitServer();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -201,6 +201,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onReadyMarkerAdded(ReadyMarker readyMarker) {
|
public synchronized void onReadyMarkerAdded(ReadyMarker readyMarker) {
|
||||||
try {
|
try {
|
||||||
|
started = true;
|
||||||
startHomekitServer();
|
startHomekitServer();
|
||||||
} catch (IOException | InvalidAlgorithmParameterException e) {
|
} catch (IOException | InvalidAlgorithmParameterException e) {
|
||||||
logger.warn("could not initialize HomeKit bridge: {}", e.getMessage());
|
logger.warn("could not initialize HomeKit bridge: {}", e.getMessage());
|
||||||
|
@ -209,6 +210,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onReadyMarkerRemoved(ReadyMarker readyMarker) {
|
public synchronized void onReadyMarkerRemoved(ReadyMarker readyMarker) {
|
||||||
|
started = false;
|
||||||
stopHomekitServer();
|
stopHomekitServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +413,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onChanged(final List<CidrAddress> added, final List<CidrAddress> removed) {
|
public synchronized void onChanged(final List<CidrAddress> added, final List<CidrAddress> removed) {
|
||||||
logger.trace("HomeKit bridge reacting on network interface changes.");
|
logger.trace("HomeKit bridge reacting on network interface changes.");
|
||||||
if (currentStartLevel < StartLevelService.STARTLEVEL_STATES) {
|
if (!started) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removed.forEach(i -> {
|
removed.forEach(i -> {
|
||||||
|
|
Loading…
Reference in New Issue