i had a problem with an equipment randomly not responding during the key exchange. as we're in a blocking read, it causes the client to hang on this read in TransportProtocolInputStream.
The provided patch replaces the BufferedInputStream with an home made TimedBufferedInputStream which stops after a 60s default timeout.
another way to fix it is replacing the following code :
try {
read = in.read(buffered, endpos, (buffered.length - endpos));
}
catch (InterruptedIOException ex) {
// We have an interrupted io; inform the event handler
with :
try {
final int waitms = 60000;
int ms = 0;
while (in.available()==0) {
try {
Thread.sleep(10);
ms += 10;
} catch (InterruptedException e) {
break;
}
if (ms >= waitms) {
throw new IOException("read timed out");
}
}
read = in.read(buffered, endpos, (buffered.length - endpos));
}
catch (InterruptedIOException ex) {
// We have an interrupted io; inform the event handler
thoses fixes have been successfully tested on the equipment that causes the problem.
A possible evolution of this patch would be the configuration of the timeout from the SshClient object.
added a timeout in TransportProtocolInputStream
Logged In: YES
user_id=1666492
Originator: YES
just forgot to mention that i used the latest cvs version