diff options
author | Hans Nilsson <[email protected]> | 2018-05-03 13:48:39 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-05-04 13:27:36 +0200 |
commit | 79e3c477f8d0d8ea397820847c576e0a0aaa5323 (patch) | |
tree | db37dab735633c1c7c2b2ee5154e5e89eaa7b0d3 /lib/ssh/src/ssh_options.erl | |
parent | a8ede33f9a51c1566ccb38df0056c3e1f092b970 (diff) | |
download | otp-79e3c477f8d0d8ea397820847c576e0a0aaa5323.tar.gz otp-79e3c477f8d0d8ea397820847c576e0a0aaa5323.tar.bz2 otp-79e3c477f8d0d8ea397820847c576e0a0aaa5323.zip |
ssh: Extend rekey_limit to also take an optional time
Diffstat (limited to 'lib/ssh/src/ssh_options.erl')
-rw-r--r-- | lib/ssh/src/ssh_options.erl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ssh/src/ssh_options.erl b/lib/ssh/src/ssh_options.erl index 4dd9082250..73287e464a 100644 --- a/lib/ssh/src/ssh_options.erl +++ b/lib/ssh/src/ssh_options.erl @@ -599,9 +599,19 @@ default(common) -> class => user_options }, - {rekey_limit, def} => % FIXME: Why not common? - #{default => 1024000000, - chk => fun check_non_neg_integer/1, + {rekey_limit, def} => + #{default => {3600000, 1024000000}, % {1 hour, 1 GB} + chk => fun({TimeMins, SizBytes}) when is_integer(TimeMins) andalso TimeMins>=0, + is_integer(SizBytes) andalso SizBytes>=0 -> + %% New (>= 21) format + {true, {TimeMins * 60*1000, % To ms + SizBytes}}; + (SizBytes) when is_integer(SizBytes) andalso SizBytes>=0 -> + %% Old (< 21) format + {true, {3600000, SizBytes}}; + (_) -> + false + end, class => user_options }, |