changeset 333:d835e842d158 ganymed

still hangs during connection
author Carl Byington <carl@five-ten-sg.com>
date Thu, 31 Jul 2014 13:45:59 -0700
parents 5c17707d94b0
children 097cfe8770dd
files src/ch/ethz/ssh2/log/Logger.java src/ch/ethz/ssh2/transport/ClientKexManager.java src/ch/ethz/ssh2/transport/TransportManager.java
diffstat 3 files changed, 15 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/log/Logger.java	Thu Jul 31 13:06:55 2014 -0700
+++ b/src/ch/ethz/ssh2/log/Logger.java	Thu Jul 31 13:45:59 2014 -0700
@@ -5,26 +5,17 @@
 
 package ch.ethz.ssh2.log;
 
-import java.util.logging.Level;
+import android.util.Log;
 
-/**
- * Logger delegating to JRE logging. By default, this is disabled and only
- * used during development.
- *
- * @author Christian Plattner
- * @version $Id: Logger.java 49 2013-08-01 12:28:42Z cleondris@gmail.com $
- */
 public class Logger {
-    private java.util.logging.Logger delegate;
-
-    public static boolean enabled = false;
+    private static final String TAG = "ConnectBot.ssh";
+    public static boolean enabled = true;
 
     public static Logger getLogger(Class<?> x) {
-        return new Logger(x);
+        return new Logger();
     }
 
-    public Logger(Class<?> x) {
-        this.delegate = java.util.logging.Logger.getLogger(x.getName());
+    public Logger() {
     }
 
     public final boolean isEnabled() {
@@ -32,29 +23,26 @@
     }
 
     public boolean isDebugEnabled() {
-        return enabled && delegate.isLoggable(Level.FINER);
+        return enabled;
     }
 
     public void debug(String message) {
-        if (enabled)
-            delegate.fine(message);
+        if (enabled) Log.d(TAG, message);
     }
 
     public boolean isInfoEnabled() {
-        return enabled && delegate.isLoggable(Level.FINE);
+        return enabled;
     }
 
     public void info(String message) {
-        if (enabled)
-            delegate.info(message);
+        if (enabled) Log.i(TAG, message);
     }
 
     public boolean isWarningEnabled() {
-        return enabled && delegate.isLoggable(Level.WARNING);
+        return enabled;
     }
 
     public void warning(String message) {
-        if (enabled)
-            delegate.warning(message);
+        if (enabled) Log.w(TAG, message);
     }
 }
\ No newline at end of file
--- a/src/ch/ethz/ssh2/transport/ClientKexManager.java	Thu Jul 31 13:06:55 2014 -0700
+++ b/src/ch/ethz/ssh2/transport/ClientKexManager.java	Thu Jul 31 13:45:59 2014 -0700
@@ -88,7 +88,7 @@
 
     public synchronized void handleMessage(byte[] msg) throws IOException {
         PacketKexInit kip;
-
+        
         if (msg == null) {
             synchronized (accessLock) {
                 connectionClosed = true;
@@ -96,6 +96,8 @@
                 return;
             }
         }
+        
+        log.debug(String.format("client kex manager, packet type %d", msg[0]));
 
         if ((kxs == null) && (msg[0] != Packets.SSH_MSG_KEXINIT)) {
             throw new PacketTypeException(msg[0]);
--- a/src/ch/ethz/ssh2/transport/TransportManager.java	Thu Jul 31 13:06:55 2014 -0700
+++ b/src/ch/ethz/ssh2/transport/TransportManager.java	Thu Jul 31 13:45:59 2014 -0700
@@ -436,6 +436,7 @@
             final byte[] packet = new byte[length];
             System.arraycopy(buffer, 0, packet, 0, length);
             final int type = packet[0] & 0xff;
+            log.debug(String.format("transport manager receive loop type %d", type));
 
             switch (type) {
                 case Packets.SSH_MSG_IGNORE: