Skip to content

Commit

Permalink
* Revert to not sending errors for set ip cmd broadcast
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Sobiech <[email protected]>
  • Loading branch information
psobiech committed Feb 5, 2024
1 parent 9056c78 commit 279ffa7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
21 changes: 12 additions & 9 deletions modules/vclu/src/main/java/pl/psobiech/opengr8on/vclu/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,22 @@ private Optional<Response> onSetIpCommand(boolean broadcast, UUID uuid, Request
logCommand(uuid, request, command);

if (Objects.equals(cluDevice.getSerialNumber(), command.getSerialNumber())) {
// we cant change IP address, so we only accept current ip address
return Optional.of(
new Response(
request.cipherKey(),
SetIpCommand.response(
cluDevice.getSerialNumber(),
cluDevice.getAddress()
if (command.getIpAddress().equals(cluDevice.getAddress())) {
// we cant change IP address, so we only accept current ip address
return Optional.of(
new Response(
request.cipherKey(),
SetIpCommand.response(
cluDevice.getSerialNumber(),
cluDevice.getAddress()
)
)
)
);
);
}
}

if (broadcast) {
// if message was a broadcast, we should not spam errors
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ void setAddressUnsupported() throws Exception {
try (CLUClient client = new CLUClient(LOCALHOST, server.getServer().getDevice(), projectCipherKey, LOCALHOST, server.getPort())) {
final Optional<Inet4Address> addressOptional = client.setAddress(IPv4AddressUtil.parseIPv4("1.1.1.1"), LOCALHOST);

assertTrue(addressOptional.isPresent());
assertEquals(LOCALHOST, addressOptional.get());
assertFalse(addressOptional.isPresent());
}
}
}

0 comments on commit 279ffa7

Please sign in to comment.