Skip to content

Commit

Permalink
Minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bmalinowsky committed Jul 14, 2024
1 parent b6f279a commit 630b543
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/io/calimero/server/knxnetip/DataEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ protected void send(final byte[] packet, final InetSocketAddress dst) throws IOE
if (TcpLooper.send(buf, dst))
return;

var actualDst = useDifferingEtsSrcPortForResponse != null ? useDifferingEtsSrcPortForResponse : dst;
final var actualDst = useDifferingEtsSrcPortForResponse != null ? useDifferingEtsSrcPortForResponse : dst;
final DatagramPacket p = new DatagramPacket(buf, buf.length, actualDst);
var src = useNat || actualDst.equals(ctrlEndpt) ? ctrlSocket.getLocalSocketAddress() : socket.getLocalSocketAddress();
final var src = useNat || actualDst.equals(ctrlEndpt) ? ctrlSocket.getLocalSocketAddress() : socket.getLocalSocketAddress();
logger.log(TRACE, "send {0}->{1} {2}", hostPort((InetSocketAddress) src),
hostPort(actualDst), HexFormat.ofDelimiter(" ").formatHex(buf));

Expand Down Expand Up @@ -446,15 +446,15 @@ else if (svc == KNXnetIPHeader.CONNECTIONSTATE_REQ) {
csr.getChannelID(), hostPort(dataEndpt), ErrorCodes.getErrorMessage(status));

final byte[] buf = PacketHelper.toPacket(new ConnectionstateResponse(csr.getChannelID(), status));
var dst = etsDstHack(csr.getControlEndpoint().endpoint(), src);
final var dst = etsDstHack(csr.getControlEndpoint().endpoint(), src);
send(buf, dst);
}
else
return false;
return true;
}

void disconnectResponse(DisconnectResponse res) {
void disconnectResponse(final DisconnectResponse res) {
if (res.getStatus() != ErrorCodes.NO_ERROR)
logger.log(WARNING, "received disconnect response status 0x{0} ({1})",
Integer.toHexString(res.getStatus()), ErrorCodes.getErrorMessage(res.getStatus()));
Expand All @@ -467,7 +467,7 @@ private void respondToFeature(final InetSocketAddress src, final KNXnetIPHeader
final TunnelingFeature res = responseForFeature(h, buffer);
logger.log(DEBUG, "respond with {0}", res);

var dst = etsDstHack(dataEndpt, src);
final var dst = etsDstHack(dataEndpt, src);
send(PacketHelper.toPacket(new ServiceRequest<ServiceType>(res.type(), channelId, getSeqSend(), res)), dst);
}

Expand Down Expand Up @@ -707,7 +707,7 @@ private void checkFrameType(final CEMI frame)

// ETS bug: ETS 6 wants the response sent to its src port the request got sent from,
// even if indicated otherwise in the HPAI or required by the spec
private InetSocketAddress etsDstHack(InetSocketAddress correct, InetSocketAddress actual) {
private InetSocketAddress etsDstHack(final InetSocketAddress correct, final InetSocketAddress actual) {
// we ignore any attempt to respond to a different IP address
if (!actual.getAddress().equals(correct.getAddress()))
return correct;
Expand Down

0 comments on commit 630b543

Please sign in to comment.