diff src/ch/ethz/ssh2/Connection.java @ 287:db9b028016de ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 19:52:08 -0700
parents 486df527ddc5
children d2ee20d9dff1
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/Connection.java	Fri Jul 18 19:26:29 2014 -0700
+++ b/src/ch/ethz/ssh2/Connection.java	Fri Jul 18 19:52:08 2014 -0700
@@ -13,6 +13,8 @@
 import java.net.Socket;
 import java.net.SocketTimeoutException;
 import java.security.SecureRandom;
+import java.security.KeyPair;
+import java.security.PrivateKey;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -638,6 +640,22 @@
     }
 
     /**
+     * Controls whether compression is used on the link or not.
+     * <p>
+     * Note: This can only be called before connect()
+     * @param enabled whether to enable compression
+     * @throws IOException
+     */
+
+    public synchronized void setCompression(boolean enabled) throws IOException {
+        if (tm != null)
+            throw new IOException("Connection to " + hostname + " is already in connected state!");
+
+        if (enabled) enableCompression();
+        else         disableCompression();
+    }
+
+    /**
      * Close the connection to the SSH-2 server. All assigned sessions will be
      * closed, too. Can be called at any time. Don't forget to call this once
      * you don't need a connection anymore - otherwise the receiver thread may