diff options
author | David Ostrovsky <david@ostrovsky.org> | 2014-03-13 00:14:44 +0100 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2014-04-23 10:39:23 +0900 |
commit | b9c66ea380130d6bfd6df95d1c779516c651e04e (patch) | |
tree | 4edad26cb0dda27ad6484c5822a5f093da76ec74 | |
parent | 977072b8ca3e26b97e077f9bd3b2a2ed52a50b02 (diff) |
Bump SSHD version to 0.10.1 and enable nio2 backend
46f8488a78742799a4f5f781279c8955460e7964 removed nio2 backend because of
a bug [1]. Given that the bug is fixed and released, enable it again.
Another problem was also fixed and released [2].
Upgrade to the official version 0.10.1 makes Gerrit's own custom patch of
SSHD and hosting it on Google bucket unnecessary.
[1] https://issues.apache.org/jira/browse/SSHD-252
[2] https://issues.apache.org/jira/browse/SSHD-255
Bug: Issue 2406
Change-Id: I6668f6194427f153e1982e14b3936d2f3132fa7d
-rw-r--r-- | Documentation/config-gerrit.txt | 8 | ||||
-rw-r--r-- | gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java | 18 | ||||
-rw-r--r-- | lib/mina/BUCK | 15 |
3 files changed, 28 insertions, 13 deletions
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index 038d946e05..ff97fb7c4e 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt @@ -2609,6 +2609,14 @@ namespace. To alias `replication start` to `gerrit replicate`: [[sshd]] Section sshd ~~~~~~~~~~~~~~~~~~~~~ +[[sshd.backend]]sshd.backend:: ++ +Starting from version 0.9.0 Apache SSHD project added support for NIO2 +IoSession. To use the new NIO2 session the `backend` option must be set +to `NIO2`. ++ +By default, `MINA`. + [[sshd.listenAddress]]sshd.listenAddress:: + Specifies the local addresses the internal SSHD should listen diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java index 4f6ccc030d..d6365e082e 100644 --- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java +++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java @@ -61,10 +61,11 @@ import org.apache.sshd.common.forward.TcpipServerChannel; import org.apache.sshd.common.future.CloseFuture; import org.apache.sshd.common.future.SshFutureListener; import org.apache.sshd.common.io.IoAcceptor; -import org.apache.sshd.common.io.IoServiceFactory; +import org.apache.sshd.common.io.IoServiceFactoryFactory; import org.apache.sshd.common.io.IoSession; -import org.apache.sshd.common.io.mina.MinaServiceFactory; +import org.apache.sshd.common.io.mina.MinaServiceFactoryFactory; import org.apache.sshd.common.io.mina.MinaSession; +import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory; import org.apache.sshd.common.mac.HMACMD5; import org.apache.sshd.common.mac.HMACMD596; import org.apache.sshd.common.mac.HMACSHA1; @@ -184,8 +185,13 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener { final String kerberosPrincipal = cfg.getString( "sshd", null, "kerberosPrincipal"); - System.setProperty(IoServiceFactory.class.getName(), - MinaServiceFactory.class.getName()); + SshSessionBackend backend = cfg.getEnum( + "sshd", null, "backend", SshSessionBackend.MINA); + + System.setProperty(IoServiceFactoryFactory.class.getName(), + backend == SshSessionBackend.MINA + ? MinaServiceFactoryFactory.class.getName() + : Nio2ServiceFactoryFactory.class.getName()); if (SecurityUtils.isBouncyCastleRegistered()) { initProviderBouncyCastle(); @@ -280,8 +286,10 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener { public synchronized void stop() { if (acceptor != null) { try { - acceptor.dispose(); + acceptor.close(true).await(); log.info("Stopped Gerrit SSHD"); + } catch (InterruptedException e) { + log.warn("Exception caught while closing", e); } finally { acceptor = null; } diff --git a/lib/mina/BUCK b/lib/mina/BUCK index 9467cc4a9b..a3577c2da0 100644 --- a/lib/mina/BUCK +++ b/lib/mina/BUCK @@ -7,19 +7,18 @@ EXCLUDE = [ ] maven_jar( - name = 'core', - id = 'org.apache.mina:mina-core:2.0.7', - sha1 = 'c878e2aa82de748474a624ec3933e4604e446dec', + name = 'sshd', + id = 'org.apache.sshd:sshd-core:0.10.1', + sha1 = '0081c09917f35565d762c886758dfbdfa1069679', license = 'Apache2.0', + deps = [':core'], exclude = EXCLUDE, ) maven_jar( - name = 'sshd', - id = 'org.apache.sshd:sshd-core:0.9.0.201311081', - sha1 = '38f7ac8602e70fa05fdc6147d204198e9cefe5bc', + name = 'core', + id = 'org.apache.mina:mina-core:2.0.7', + sha1 = 'c878e2aa82de748474a624ec3933e4604e446dec', license = 'Apache2.0', - deps = [':core'], exclude = EXCLUDE, - repository = GERRIT, ) |