mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[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
610ac572c5
commit
bab2a1f373
@ -85,7 +85,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||
private final List<HomekitServer> homekitServers = new ArrayList<>();
|
||||
private final List<HomekitRoot> bridges = new ArrayList<>();
|
||||
private MDNSClient mdnsClient;
|
||||
private int currentStartLevel = 0;
|
||||
private boolean started = false;
|
||||
|
||||
private final List<HomekitChangeListener> changeListeners = new ArrayList<>();
|
||||
|
||||
@ -164,7 +164,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||
|| oldSettings.instances != settings.instances) {
|
||||
// the HomeKit server settings changed. we do a complete re-init
|
||||
stopHomekitServer();
|
||||
if (currentStartLevel >= StartLevelService.STARTLEVEL_STATES) {
|
||||
if (started) {
|
||||
startHomekitServer();
|
||||
}
|
||||
} else {
|
||||
@ -185,6 +185,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||
@Override
|
||||
public synchronized void onReadyMarkerAdded(ReadyMarker readyMarker) {
|
||||
try {
|
||||
started = true;
|
||||
startHomekitServer();
|
||||
} catch (IOException | InvalidAlgorithmParameterException e) {
|
||||
logger.warn("could not initialize HomeKit bridge: {}", e.getMessage());
|
||||
@ -193,6 +194,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||
|
||||
@Override
|
||||
public synchronized void onReadyMarkerRemoved(ReadyMarker readyMarker) {
|
||||
started = false;
|
||||
stopHomekitServer();
|
||||
}
|
||||
|
||||
@ -326,7 +328,7 @@ public class HomekitImpl implements Homekit, NetworkAddressChangeListener, Ready
|
||||
@Override
|
||||
public synchronized void onChanged(final List<CidrAddress> added, final List<CidrAddress> removed) {
|
||||
logger.trace("HomeKit bridge reacting on network interface changes.");
|
||||
if (currentStartLevel < StartLevelService.STARTLEVEL_STATES) {
|
||||
if (!started) {
|
||||
return;
|
||||
}
|
||||
removed.forEach(i -> {
|
||||
|
Loading…
Reference in New Issue
Block a user