Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Connection use a SessionFactory to create Session instances? #47

Open
GoogleCodeExporter opened this issue Dec 8, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Ganymed release: 2.6.2

This issue is not a bug, but rather an improvement to consider.

In Sun_SSH server version 1.0.1 it appears that closing a Session obtained from 
Connection.openSession() can cause the entire connection to go down. Trying to 
re-use the Connection object will cause a failure. Therefore we would like to 
handle the Session.close() function a bit differently. 

It would be nice to subclass the Session object, and then perform extra 
functionality for the close() function if such a server version is encountered. 
Unfortunately the ability to do this isn't possible because the 
Connection.openSession() uses internal private members (namely the 
ChannelManager) to construct a Session object, so subclassing the Connection 
object is not helpful.

Connection.java
----
public synchronized Session openSession() throws IOException {
    this.checkConnection();

    return new Session(cm, getOrCreateSecureRND());
}
----

Therefore, would it be possible to have the Connection object use a 
SessionFactory instead that can be set on the Connection object to create 
Session instances when openSession() is called? 

This would be general enough to allow various tweaks to be done to the Session 
objects, through subclassing, that are returned from Connection.openSession().

Attached is a proposed implementation to allow this functionality.

Original issue reported on code.google.com by [email protected] on 29 Jul 2014 at 9:09

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant