--- j2ssh/build.xml 2003-12-08 14:30:18.000000000 +0100 +++ j2ssh-0.2.7-rob/build.xml 2005-10-19 12:53:50.000000000 +0200 @@ -15,7 +15,7 @@ - + --- j2ssh/src/com/sshtools/j2ssh/SshClient.java 2003-12-08 14:25:00.000000000 +0100 +++ j2ssh-0.2.7-rob/src/com/sshtools/j2ssh/SshClient.java 2006-02-07 11:39:58.000000000 +0100 @@ -113,7 +113,7 @@ *

* * @author Lee David Painter - * @version $Revision: 1.75 $ + * @version $Revision: 1.3 $ * * @since 0.2.0 */ @@ -774,15 +774,19 @@ TransportProvider provider = TransportProviderFactory.connectTransportProvider(properties /*, connectTimeout*/, socketTimeout); +// System.err.println("start transport"); // Start the transport protocol transport = new TransportProtocolClient(hostVerification); transport.addEventHandler(eventHandler); transport.startTransportProtocol(provider, properties); +// System.err.println("transport done"); // Start the authentication protocol authentication = new AuthenticationProtocolClient(); authentication.addEventListener(eventHandler); transport.requestService(authentication); +// System.err.println("auth done"); + connection = new ConnectionProtocol(); if (useDefaultForwarding) { --- j2ssh/src/com/sshtools/j2ssh/transport/TransportProtocolClient.java 2003-12-08 13:54:52.000000000 +0100 +++ j2ssh-0.2.7-rob/src/com/sshtools/j2ssh/transport/TransportProtocolClient.java 2005-10-25 08:54:52.000000000 +0200 @@ -51,7 +51,7 @@ * * * @author $author$ - * @version $Revision: 1.49 $ + * @version $Revision: 1.3 $ */ public class TransportProtocolClient extends TransportProtocolCommon { /** */ @@ -324,8 +324,10 @@ * @throws TransportProtocolException */ protected void onStartTransportProtocol() throws IOException { + synchronized (state) { // @@@ added by rob. while ((state.getValue() != TransportProtocolState.CONNECTED) && - (state.getValue() != TransportProtocolState.DISCONNECTED)) { + (state.getValue() != TransportProtocolState.DISCONNECTED) && + (state.getLastError() == null)) { try { state.waitForStateUpdate(); } catch (InterruptedException ex) { @@ -341,6 +343,7 @@ "The connection did not complete"); } } + } } /** --- j2ssh/src/com/sshtools/j2ssh/transport/TransportProtocolCommon.java 2003-12-08 13:54:52.000000000 +0100 +++ j2ssh-0.2.7-rob/src/com/sshtools/j2ssh/transport/TransportProtocolCommon.java 2006-02-07 11:39:58.000000000 +0100 @@ -59,7 +59,7 @@ * * * @author $author$ - * @version $Revision: 1.87 $ + * @version $Revision: 1.4 $ */ public abstract class TransportProtocolCommon implements TransportProtocol, Runnable { @@ -372,8 +372,12 @@ // call abstract to initialise the local ident string setLocalIdent(); + try { // negotiate the protocol version - negotiateVersion(); + negotiateVersion(); + } catch (Throwable t) { + System.err.println("warning, could not identify remote protocol version, assuming ssh2"); + } startBinaryPacketProtocol(); } catch (Throwable e) { if (e instanceof IOException) { @@ -1139,6 +1143,8 @@ // Set trimming off any EOL characters remoteVer = buffer.toString(); +// System.err.println("remote Ver = " + remoteVer); + // Guess the remote sides EOL by looking at the end of the ident string if (remoteVer.endsWith("\r")) { remoteEOL = EOL_CRLF; --- j2ssh/src/com/sshtools/j2ssh/transport/TransportProtocolState.java 2003-12-08 13:54:52.000000000 +0100 +++ j2ssh-0.2.7-rob/src/com/sshtools/j2ssh/transport/TransportProtocolState.java 2005-10-25 08:54:52.000000000 +0200 @@ -35,7 +35,7 @@ * * * @author $author$ - * @version $Revision: 1.24 $ + * @version $Revision: 1.2 $ */ public class TransportProtocolState extends State { /** */ @@ -71,8 +71,9 @@ * * @param lastError */ - protected void setLastError(IOException lastError) { + protected synchronized void setLastError(IOException lastError) { this.lastError = lastError; + notifyAll(); } /**