aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/trilead/ssh2/Connection.java
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2008-11-11 07:18:26 +0000
committerKenny Root <kenny@the-b.org>2008-11-11 07:18:26 +0000
commit1a2f49f29cd051d27cc87c08c4da67175b2ea3fe (patch)
treec9a42d8fe34baf75f6f53e07eccb661de4242357 /src/com/trilead/ssh2/Connection.java
parentd95071c05fccd687bbfbac98c100acf17724adb2 (diff)
downloadconnectbot-1a2f49f29cd051d27cc87c08c4da67175b2ea3fe.tar.gz
connectbot-1a2f49f29cd051d27cc87c08c4da67175b2ea3fe.tar.bz2
connectbot-1a2f49f29cd051d27cc87c08c4da67175b2ea3fe.zip
* Add compression option to hosts
Diffstat (limited to 'src/com/trilead/ssh2/Connection.java')
-rw-r--r--src/com/trilead/ssh2/Connection.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/trilead/ssh2/Connection.java b/src/com/trilead/ssh2/Connection.java
index 2b244c2..1741a4c 100644
--- a/src/com/trilead/ssh2/Connection.java
+++ b/src/com/trilead/ssh2/Connection.java
@@ -89,6 +89,7 @@ public class Connection
private AuthenticationManager am;
private boolean authenticated = false;
+ private boolean compression = false;
private ChannelManager cm;
private CryptoWishList cryptoWishList = new CryptoWishList();
@@ -575,6 +576,20 @@ public class Connection
}
/**
+ * 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!");
+
+ compression = enabled;
+ }
+
+ /**
* 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
@@ -735,6 +750,12 @@ public class Connection
tm.setConnectionMonitors(connectionMonitors);
+ // Don't offer compression if not requested
+ if (!compression) {
+ cryptoWishList.c2s_comp_algos = new String[] { "none" };
+ cryptoWishList.s2c_comp_algos = new String[] { "none" };
+ }
+
/*
* Make sure that the runnable below will observe the new value of "tm"
* and "state" (the runnable will be executed in a different thread,