Merge "Bump SSHD version to 0.10.1 and enable nio2 backend"

This commit is contained in:
David Pursehouse 2014-03-24 19:01:31 +00:00 committed by Gerrit Code Review
commit 4e3db18a7d
3 changed files with 30 additions and 15 deletions

View File

@ -2642,6 +2642,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,
)