Timeouts not propogated to connect statements
Brought to you by:
johanwalles,
kerneldebugger
The default timeout passed to the ExpectJ constructor is not propagated to connect statements. If a firewall is silently discarding packets, connects take over 3.5 minutes to fail.
Here's an example of what would need to change, using a hard-coded timeout of 10 seconds (10000ms):
public void start() throws IOException {
m_socket = new Socket();
m_socket.connect(new InetSocketAddress(m_remoteHost, m_remotePort), 10000);
m_fromSocket = m_socket.getInputStream();
m_toSocket = m_socket.getOutputStream();
}
For SshSpawn, the connect method of Jsch sessions also takes a timeout value in milliseconds.
Thanks!
The code in the original bug report above was the start() method of TelnetSpawn. In SshSpawn, the only line that would need to be changed is the one where I've passed 10,000ms below. There's multiple ways the default timeout could be propagated into those start() methods. If an official maintainer likes one way in particular and tells me, I could provide a patch without the hard-coded values.
m_session = new JSch().getSession(m_username, m_remoteHost, m_remotePort) ;
m_session.setPassword(m_password) ;
m_session.setConfig("StrictHostKeyChecking", "no");
m_session.connect(10000) ;