Bump SSHD version to 0.10.1 and enable nio2 backend

46f8488a78 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
This commit is contained in:
David Ostrovsky 2014-03-13 00:14:44 +01:00 committed by David Pursehouse
parent 977072b8ca
commit b9c66ea380
3 changed files with 30 additions and 15 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -6,6 +6,15 @@ EXCLUDE = [
'META-INF/NOTICE',
]
maven_jar(
name = 'sshd',
id = 'org.apache.sshd:sshd-core:0.10.1',
sha1 = '0081c09917f35565d762c886758dfbdfa1069679',
license = 'Apache2.0',
deps = [':core'],
exclude = EXCLUDE,
)
maven_jar(
name = 'core',
id = 'org.apache.mina:mina-core:2.0.7',
@ -13,13 +22,3 @@ maven_jar(
license = 'Apache2.0',
exclude = EXCLUDE,
)
maven_jar(
name = 'sshd',
id = 'org.apache.sshd:sshd-core:0.9.0.201311081',
sha1 = '38f7ac8602e70fa05fdc6147d204198e9cefe5bc',
license = 'Apache2.0',
deps = [':core'],
exclude = EXCLUDE,
repository = GERRIT,
)