changeset 372:20d0a1356c43

debug kex error
author Carl Byington <carl@five-ten-sg.com>
date Mon, 04 Aug 2014 12:11:12 -0700
parents 071a1ff9b6bf
children 2768eb029d73
files src/ch/ethz/ssh2/Connection.java src/ch/ethz/ssh2/transport/TransportConnection.java
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/Connection.java	Mon Aug 04 11:42:15 2014 -0700
+++ b/src/ch/ethz/ssh2/Connection.java	Mon Aug 04 12:11:12 2014 -0700
@@ -672,13 +672,13 @@
      * run forever.
      */
 
-    public void close() {
+    public synchronized void close() {
         log.debug("Connection.close()");
         Throwable t = new Throwable("Closed due to user request.");
         close(t, false);
     }
 
-    public void close(Throwable t, boolean hard) {
+    public synchronized void close(Throwable t, boolean hard) {
         log.debug(String.format("Connection.close(%s hard=%b)", t.getMessage(), hard));
         if (cm != null) {
             cm.closeAllChannels();
--- a/src/ch/ethz/ssh2/transport/TransportConnection.java	Mon Aug 04 11:42:15 2014 -0700
+++ b/src/ch/ethz/ssh2/transport/TransportConnection.java	Mon Aug 04 12:11:12 2014 -0700
@@ -231,9 +231,10 @@
             recv_packet_header_present = true;
         }
 
-        int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24)
-                            | ((recv_packet_header_buffer[1] & 0xff) << 16) | ((recv_packet_header_buffer[2] & 0xff) << 8)
-                            | ((recv_packet_header_buffer[3] & 0xff));
+        int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24) |
+                            ((recv_packet_header_buffer[1] & 0xff) << 16) |
+                            ((recv_packet_header_buffer[2] & 0xff) << 8)  |
+                            ((recv_packet_header_buffer[3] & 0xff));
         int padding_length = recv_packet_header_buffer[4] & 0xff;
 
         if (packet_length > TransportManager.MAX_PACKET_SIZE || packet_length < 12) {
@@ -257,9 +258,10 @@
             recv_packet_header_present = false;
         }
 
-        int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24)
-                            | ((recv_packet_header_buffer[1] & 0xff) << 16) | ((recv_packet_header_buffer[2] & 0xff) << 8)
-                            | ((recv_packet_header_buffer[3] & 0xff));
+        int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24) |
+                            ((recv_packet_header_buffer[1] & 0xff) << 16) |
+                            ((recv_packet_header_buffer[2] & 0xff) << 8)  |
+                            ((recv_packet_header_buffer[3] & 0xff));
         int padding_length = recv_packet_header_buffer[4] & 0xff;
 
         if (packet_length > TransportManager.MAX_PACKET_SIZE || packet_length < 12) {