infinite wait for transport connection state change

Bernardo F Costa <[email protected]>
Newsgroups gmane.comp.java.sshtools.user
Message-ID <[email protected]>
Hello,

I recently faced some problems with j2ssh, when I
tried to use it with a ssh server who has a bad
network link. Some exception was raised during
negotiation phase made a transport protocol thread
hang up. The same problem will also arise if you try
to connect to a ssh server who has a protocol version
different from 2.0 or 1.99. I have found that the
problem was a missing update of the connection state,
when this particular thread stops. I am sending the
patch that corrects it. The attached patch file has
two patches: one is for this I have explained here and
the other is about a similar situation at my last
message to the list.


---
src/com/sshtools/j2ssh/transport/TransportProtocolCommon.java
      2003-12-08 10:54:52.000000
000 -0200
+++
src/com/sshtools/j2ssh/transport/TransportProtocolCommon.java
      2007-01-07 11:57:07.000000
000 -0200
@@ -1052,6 +1052,7 @@
             provider.close();
         } catch (IOException ioe) {
         }
+      
state.setValue(TransportProtocolState.DISCONNECTED);
     }
 
     private byte[] makeSshKey(char chr) throws
IOException {


__________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Sshtools-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sshtools-users
patch.txt (text/plain, 1.2 KB)
--- src/com/sshtools/j2ssh/transport/TransportProtocolCommon.java	2003-12-08 10:54:52.000000000 -0200
+++ src/com/sshtools/j2ssh/transport/TransportProtocolCommon.java	2007-01-07 11:57:07.000000000 -0200
@@ -1052,6 +1052,7 @@
             provider.close();
         } catch (IOException ioe) {
         }
+	state.setValue(TransportProtocolState.DISCONNECTED);
     }
 
     private byte[] makeSshKey(char chr) throws IOException {
--- src/com/sshtools/j2ssh/transport/TransportProtocolOutputStream.java	2003-12-08 10:54:52.000000000 -0200
+++ src/com/sshtools/j2ssh/transport/TransportProtocolOutputStream.java	2007-01-06 22:37:53.000000000 -0200
@@ -178,7 +178,7 @@
             out.write(message.toByteArray());
 
             out.flush();
-            algorithms.release();
+            //algorithms.release(); an exception at out.write an deadlock !!!
 
             // Increment the sequence no
             if (sequenceNo < sequenceWrapLimit) {
@@ -191,6 +191,8 @@
                 throw new TransportProtocolException("IO Error on socket: " +
                     ioe.getMessage());
             }
-        }
+        } finally {
+	   algorithms.release();
+	}
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.