mattrpav commented on code in PR #1884:
URL: https://github.com/apache/karaf/pull/1884#discussion_r1840778515


##########
shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java:
##########
@@ -189,6 +194,20 @@ protected SshServer createSshServer(SessionFactory 
sessionFactory) {
         
server.setKeyExchangeFactories(SshUtils.buildKexAlgorithms(kexAlgorithms));
         
server.setSignatureFactories(SshUtils.buildSigAlgorithms(sigAlgorithms));
         server.setShellFactory(new ShellFactoryImpl(sessionFactory));
+        server.addSessionListener(new SessionListener() {
+            @Override
+            public void 
sessionDisconnect(org.apache.sshd.common.session.Session session, int reason, 
String msg, String language, boolean initiator) {
+                try {
+                    Collection<ServiceReference<ChannelResourceCleaner>> 
references = bundleContext.getServiceReferences(ChannelResourceCleaner.class, 
null);
+                    for (ServiceReference<ChannelResourceCleaner> reference : 
references) {
+                        ChannelResourceCleaner cleaner = 
bundleContext.getService(reference);
+                        cleaner.close();

Review Comment:
   This appears to call .close() on _every_ reference for every session that 
closes. Is that the correct association? 
   
   Wouldn't we want to close only the instance of the command associated with 
that session?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to