This reverts commit 72622a1409d143915b912de538083cf6bc7e1cc9. Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
5a5cfc28fb
commit
94f2837fe0
@ -141,10 +141,12 @@ public class Shelly2ApiRpc extends Shelly2ApiClient implements ShellyApiInterfac
|
||||
rpcSocket.addMessageHandler(this);
|
||||
initialized = true;
|
||||
} else {
|
||||
if (rpcSocket.isConnected()) {
|
||||
logger.debug("{}: Disconnect Rpc Socket on initialize", thingName);
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
@ -1215,8 +1217,10 @@ public class Shelly2ApiRpc extends Shelly2ApiClient implements ShellyApiInterfac
|
||||
}
|
||||
|
||||
private void disconnect() {
|
||||
if (rpcSocket.isConnected()) {
|
||||
rpcSocket.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public Shelly2RpctInterface getRpcHandler() {
|
||||
return this;
|
||||
|
||||
@ -211,7 +211,9 @@ public class Shelly2RpcSocket {
|
||||
s.close(StatusCode.NORMAL, "Socket closed");
|
||||
session = null;
|
||||
}
|
||||
if (client.isStarted()) {
|
||||
client.stop();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e.getCause() instanceof InterruptedException) {
|
||||
logger.debug("{}: Unable to close socket - interrupted", thingName); // e.g. device was rebooted
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user