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


##########
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:
   That's right it's a bit agressive: if we have several ssh clients on the 
Karaf ssh server, we will close *all* references whatever is the client.
   It's pretty hard to "link" the session with the command (or maybe we can use 
a session property to identify the correct 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