diff options
author | Hans Nilsson <[email protected]> | 2015-04-30 16:33:44 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2015-04-30 16:33:44 +0200 |
commit | afd7d321ed5fe9b34d8a2dd18bda3d14978410ca (patch) | |
tree | 430daae4af8802ab094ad552af29b6bd58e6df69 /lib/ssh/src/ssh_connection_handler.erl | |
parent | f52d2814ca178d75ed04b843831288275f543f90 (diff) | |
parent | ec5dcc8a6b9f86aa8dd02c70b630460cdc0833df (diff) | |
download | otp-afd7d321ed5fe9b34d8a2dd18bda3d14978410ca.tar.gz otp-afd7d321ed5fe9b34d8a2dd18bda3d14978410ca.tar.bz2 otp-afd7d321ed5fe9b34d8a2dd18bda3d14978410ca.zip |
Merge branch 'hans/ssh/rekey/OTP-12692'
* hans/ssh/rekey/OTP-12692:
ssh: Fix bug causing rekeying once per minute after 1st Gbyte Thanks Simon
Diffstat (limited to 'lib/ssh/src/ssh_connection_handler.erl')
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index e1f2e059e8..4dea284071 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -70,6 +70,7 @@ undecoded_packet_length, % integer() key_exchange_init_msg, % #ssh_msg_kexinit{} renegotiate = false, % boolean() + last_size_rekey = 0, connection_queue, address, port, @@ -635,7 +636,8 @@ handle_event(renegotiate, StateName, State) -> %% Rekey due to sent data limit reached? handle_event(data_size, connected, #state{ssh_params = Ssh0} = State) -> - {ok, [{send_oct,Sent}]} = inet:getstat(State#state.socket, [send_oct]), + {ok, [{send_oct,Sent0}]} = inet:getstat(State#state.socket, [send_oct]), + Sent = Sent0 - State#state.last_size_rekey, MaxSent = proplists:get_value(rekey_limit, State#state.opts, 1024000000), timer:apply_after(?REKEY_DATA_TIMOUT, gen_fsm, send_all_state_event, [self(), data_size]), case Sent >= MaxSent of @@ -645,7 +647,8 @@ handle_event(data_size, connected, #state{ssh_params = Ssh0} = State) -> {next_state, kexinit, next_packet(State#state{ssh_params = Ssh, key_exchange_init_msg = KeyInitMsg, - renegotiate = true})}; + renegotiate = true, + last_size_rekey = Sent0})}; _ -> {next_state, connected, next_packet(State)} end; |