Skip to content

Commit

Permalink
Fix memory leak in SSLConnectionLogger (#1321)
Browse files Browse the repository at this point in the history
Signed-off-by: Ofer Levi <[email protected]>
  • Loading branch information
OferLevi85 authored Mar 4, 2021
1 parent c41ed9b commit 91df3a6
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ public void onClosed(Connection connection) {
metric.increment(METRIC_NAME, info.toMetric());
}
connectionInfo.remove(endpoint);
if (connection instanceof SslConnection) {
SSLEngine sslEngine = ((SslConnection) connection).getSSLEngine();
sslToConnectionInfo.remove(sslEngine);
}
}
});
}
Expand All @@ -140,9 +144,13 @@ public void handshakeSucceeded(Event event) {
public void handshakeFailed(Event event, Throwable failure) {
SSLEngine sslEngine = event.getSSLEngine();
handleListenerInvocation("SslHandshakeListener", "handshakeFailed", "sslEngine=%h,failure=%s", Stream.of(sslEngine, failure).collect(Collectors.toList()), () -> {
LOGGER.error(failure.getMessage());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(failure.getMessage());
}
ConnectionInfo info = sslToConnectionInfo.remove(sslEngine);
info.setSslHandshakeFailure(failure);
if (info != null) {
info.setSslHandshakeFailure(failure);
}
});
}
//
Expand Down

0 comments on commit 91df3a6

Please sign in to comment.