Merge branch 'stable-2.13' into stable-2.14

* stable-2.13:
  Fix typo in waitTimeout configuration and clarify its use
  SshDaemon: introduce sshd.waitTimeout to set WAIT_FOR_SPACE_TIMEOUT

Change-Id: I9d8b69a5dbbf3a5f173285b463e6c4c92b1bdbe5
This commit is contained in:
David Pursehouse 2017-10-17 08:09:28 +09:00
commit 98d619d3aa
2 changed files with 23 additions and 2 deletions

View File

@ -4108,8 +4108,9 @@ By default, 2 minutes.
[[sshd.idleTimeout]]sshd.idleTimeout::
+
Time in seconds after which the server automatically terminates idle
connections (or 0 to disable closing of idle connections). Values
should use common unit suffixes to express their setting:
connections (or 0 to disable closing of idle connections) not waiting for
any server operation to complete.
Values should use common unit suffixes to express their setting:
+
* s, sec, second, seconds
* m, min, minute, minutes
@ -4119,6 +4120,21 @@ should use common unit suffixes to express their setting:
+
By default, 0.
[[sshd.waitTimeout]]sshd.waitTimeout::
+
Time in seconds after which the server automatically terminates
connections waiting for a server operation to complete, like for instance
cloning a very large repo with lots of refs.
Values should use common unit suffixes to express their setting:
+
* s, sec, second, seconds
* m, min, minute, minutes
* h, hr, hour, hours
* d, day, days
+
By default, 30s.
[[sshd.maxConnectionsPerUser]]sshd.maxConnectionsPerUser::
+
Maximum number of concurrent SSH sessions that a user account

View File

@ -17,6 +17,7 @@ package com.google.gerrit.sshd;
import static com.google.gerrit.server.ssh.SshAddressesModule.IANA_SSH_PORT;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.sshd.common.channel.ChannelOutputStream.WAIT_FOR_SPACE_TIMEOUT;
import com.google.common.base.Strings;
import com.google.common.base.Supplier;
@ -199,6 +200,10 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
REKEY_BYTES_LIMIT,
String.valueOf(cfg.getLong("sshd", "rekeyBytesLimit", 1024 * 1024 * 1024 /* 1GB */)));
long waitTimeoutSeconds = ConfigUtil.getTimeUnit(cfg, "sshd", null, "waitTimeout", 30, SECONDS);
getProperties()
.put(WAIT_FOR_SPACE_TIMEOUT, String.valueOf(SECONDS.toMillis(waitTimeoutSeconds)));
final int maxConnectionsPerUser = cfg.getInt("sshd", "maxConnectionsPerUser", 64);
if (0 < maxConnectionsPerUser) {
getProperties().put(MAX_CONCURRENT_SESSIONS, String.valueOf(maxConnectionsPerUser));