diff options
author | Ingela Anderton Andin <[email protected]> | 2018-12-14 11:03:45 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2018-12-14 11:05:17 +0100 |
commit | 96db55840b25fa8bde5bbbf93c9bd92782e3147c (patch) | |
tree | 794e612875eac6b4fc76647352a873a1f453ff31 /lib/ssl/src/tls_sender.erl | |
parent | d2602d435638a4db13d8cd6f454995c23ceaad65 (diff) | |
parent | a2cdf319505b102c0b8bb192d36a08448d304559 (diff) | |
download | otp-96db55840b25fa8bde5bbbf93c9bd92782e3147c.tar.gz otp-96db55840b25fa8bde5bbbf93c9bd92782e3147c.tar.bz2 otp-96db55840b25fa8bde5bbbf93c9bd92782e3147c.zip |
Merge branch 'maint'
Conflicts:
lib/ssl/src/dtls_connection.erl
lib/ssl/src/ssl_connection.erl
lib/ssl/src/ssl_connection.hrl
lib/ssl/src/tls_connection.erl
lib/ssl/src/tls_record.erl
Diffstat (limited to 'lib/ssl/src/tls_sender.erl')
-rw-r--r-- | lib/ssl/src/tls_sender.erl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/ssl/src/tls_sender.erl b/lib/ssl/src/tls_sender.erl index 0631ed808a..4399999221 100644 --- a/lib/ssl/src/tls_sender.erl +++ b/lib/ssl/src/tls_sender.erl @@ -29,7 +29,7 @@ %% API -export([start/0, start/1, initialize/2, send_data/2, send_alert/2, - send_and_ack_alert/2, setopts/2, renegotiate/1, + send_and_ack_alert/2, setopts/2, renegotiate/1, downgrade/2, update_connection_state/3, dist_tls_socket/1, dist_handshake_complete/3]). %% gen_statem callbacks @@ -126,6 +126,21 @@ renegotiate(Pid) -> %%-------------------------------------------------------------------- update_connection_state(Pid, NewState, Version) -> gen_statem:cast(Pid, {new_write, NewState, Version}). + +%%-------------------------------------------------------------------- +-spec downgrade(pid(), integer()) -> {ok, ssl_record:connection_state()} + | {error, timeout}. +%% Description: So TLS connection process can synchronize the +%% encryption state to be used when sending application data. +%%-------------------------------------------------------------------- +downgrade(Pid, Timeout) -> + try gen_statem:call(Pid, downgrade, Timeout) of + Result -> + Result + catch + _:_ -> + {error, timeout} + end. %%-------------------------------------------------------------------- -spec dist_handshake_complete(pid(), node(), term()) -> ok. %% Description: Erlang distribution callback @@ -242,6 +257,9 @@ connection({call, From}, {ack_alert, #alert{} = Alert}, StateData0) -> StateData = send_tls_alert(Alert, StateData0), {next_state, ?FUNCTION_NAME, StateData, [{reply,From,ok}]}; +connection({call, From}, downgrade, #data{connection_states = + #{current_write := Write}} = StateData) -> + {next_state, death_row, StateData, [{reply,From, {ok, Write}}]}; connection(internal, {application_packets, From, Data}, StateData) -> send_application_data(Data, From, ?FUNCTION_NAME, StateData); %% |