From 575d4943f1b84d67ed1a090d3fd6395f49fb56e7 Mon Sep 17 00:00:00 2001 From: bmalinowsky Date: Sun, 18 Aug 2024 13:11:22 +0200 Subject: [PATCH] Pass initiator and reason to connection::close --- src/io/calimero/knxnetip/StreamConnection.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/io/calimero/knxnetip/StreamConnection.java b/src/io/calimero/knxnetip/StreamConnection.java index 690f686d..23555508 100644 --- a/src/io/calimero/knxnetip/StreamConnection.java +++ b/src/io/calimero/knxnetip/StreamConnection.java @@ -212,12 +212,16 @@ private enum SessionState { Idle, Unauthenticated, Authenticated } @Override public void close() { + close(CloseEvent.USER_REQUEST, "user request"); + } + + void close(final int initiator, final String reason) { if (sessionState == SessionState.Idle) return; sessionState = SessionState.Idle; keepAliveFuture.cancel(false); - securedConnections.values().forEach(ClientConnection::close); + securedConnections.values().forEach(c -> c.close(initiator, reason, Level.DEBUG, null)); securedConnections.clear(); conn.sessions.remove(sessionId); @@ -647,7 +651,7 @@ void close(final int initiator, final String reason) { unsecuredConnections.values().forEach(t -> t.close(initiator, reason, Level.DEBUG, null)); unsecuredConnections.clear(); - sessions.values().forEach(SecureSession::close); + sessions.values().forEach(s -> s.close(initiator, reason)); sessions.clear(); }