Hello.
I'm using the latest version of the library and, almost every time, on the first attempt of making the Session establishing a connection I've the same issue as in #614.
The strange thing is that, on the next retry, it works fine with no issue.
Therefore, I had simply the idea to reconnect (even though it would be nice if the library would do it automatically given that I'm configuring the MaxAuthAttempts) by doing something like the following:
Session session = ... get the session
try {
session.connect(timeout);
} catch(JSchException ex) {
if(ex.getMessage().contains("Auth fail")) {
session.disconnect();
session.connect(); // it fails with the reported error here
} else {
throw new RuntimeException(ex);
}
}
This StackOverflow comment https://stackoverflow.com/questions/27838523/jschexception-packet-corrupt/30855201#30855201 is somehow suggesting that, even if I call disconnect, the Session object is somehow holding this packet.
Would it be possible to ensure that, if disconnect is called, the state of the Session object gets wiped out so that the next call to connect would behave like if such an object was created for the first time?
Hello.
I'm using the latest version of the library and, almost every time, on the first attempt of making the
Sessionestablishing a connection I've the same issue as in #614.The strange thing is that, on the next retry, it works fine with no issue.
Therefore, I had simply the idea to reconnect (even though it would be nice if the library would do it automatically given that I'm configuring the
MaxAuthAttempts) by doing something like the following:This StackOverflow comment https://stackoverflow.com/questions/27838523/jschexception-packet-corrupt/30855201#30855201 is somehow suggesting that, even if I call
disconnect, theSessionobject is somehow holding this packet.Would it be possible to ensure that, if
disconnectis called, the state of theSessionobject gets wiped out so that the next call toconnectwould behave like if such an object was created for the first time?