diff options
author | Raimo Niskanen <[email protected]> | 2017-09-27 11:44:19 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2017-09-27 11:44:19 +0200 |
commit | 0a0f28747f6765103f160b75f5114be866ed28ce (patch) | |
tree | 49e48fe409dfc074e00983fce8a853bea9350cc4 /lib/ssl | |
parent | 80103ef6d8e1dd2f3be1ec33924c74f4f9362301 (diff) | |
download | otp-0a0f28747f6765103f160b75f5114be866ed28ce.tar.gz otp-0a0f28747f6765103f160b75f5114be866ed28ce.tar.bz2 otp-0a0f28747f6765103f160b75f5114be866ed28ce.zip |
Pass all info's to the ssl_connection state function
Diffstat (limited to 'lib/ssl')
-rw-r--r-- | lib/ssl/src/dtls_connection.erl | 3 | ||||
-rw-r--r-- | lib/ssl/src/ssl_connection.erl | 43 | ||||
-rw-r--r-- | lib/ssl/src/tls_connection.erl | 3 |
3 files changed, 24 insertions, 25 deletions
diff --git a/lib/ssl/src/dtls_connection.erl b/lib/ssl/src/dtls_connection.erl index 56ed232b2d..ad560c0756 100644 --- a/lib/ssl/src/dtls_connection.erl +++ b/lib/ssl/src/dtls_connection.erl @@ -540,8 +540,7 @@ handle_info(new_cookie_secret, StateName, CookieInfo#{current_cookie_secret => dtls_v1:cookie_secret(), previous_cookie_secret => Secret}}}; handle_info(Msg, StateName, State) -> - ssl_connection:handle_info(Msg, StateName, State). -%%% ssl_connection:StateName(info, Msg, State, ?MODULE). + ssl_connection:StateName(info, Msg, State, ?MODULE). handle_call(Event, From, StateName, State) -> diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index 008e7e1704..dd62ccddcd 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -829,6 +829,26 @@ connection( end; connection({call, From}, Msg, State, Connection) -> handle_call(Msg, From, connection, State, Connection); +connection( + info, dist_data = Msg, + #state{ + ssl_options = #ssl_options{erl_dist = true}, + protocol_specific = #{d_handle := DHandle}} = State, + _) -> + eat_msgs(Msg), + try send_dist_data(connection, State, DHandle, []) + catch _:Reason -> + death_row(State, Reason) + end; +connection( + info, tick = Msg, + #state{ + ssl_options = #ssl_options{erl_dist = true}, + protocol_specific = #{d_handle := _}}, + _) -> + eat_msgs(Msg), + {keep_state_and_data, + [{next_event, {call, {self(), undefined}}, {application_data, <<>>}}]}; connection(info, Msg, State, _) -> handle_info(Msg, connection, State); connection(internal, {recv, _}, State, Connection) -> @@ -1080,32 +1100,13 @@ handle_info({cancel_start_or_recv, RecvFrom}, StateName, handle_info({cancel_start_or_recv, _RecvFrom}, StateName, State) -> {next_state, StateName, State#state{timer = undefined}}; -handle_info( - dist_data = Msg, - connection, - #state{ - ssl_options = #ssl_options{erl_dist = true}, - protocol_specific = #{d_handle := DHandle}} = State) -> - eat_msgs(Msg), - try send_dist_data(connection, State, DHandle, []) - catch _:Reason -> - death_row(State, Reason) - end; -handle_info( - tick = Msg, - connection, - #state{ - ssl_options = #ssl_options{erl_dist = true}, - protocol_specific = #{d_handle := _}}) -> - eat_msgs(Msg), - {keep_state_and_data, - [{next_event, {call, {self(), undefined}}, {application_data, <<>>}}]}; - handle_info(Msg, StateName, #state{socket = Socket, error_tag = Tag} = State) -> Report = io_lib:format("SSL: Got unexpected info: ~p ~n", [{Msg, Tag, Socket}]), error_logger:info_report(Report), {next_state, StateName, State}. + + send_dist_data(StateName, State, DHandle, Acc) -> case erlang:dist_ctrl_get_data(DHandle) of none -> diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl index 1c506fe951..16b30a92c6 100644 --- a/lib/ssl/src/tls_connection.erl +++ b/lib/ssl/src/tls_connection.erl @@ -441,8 +441,7 @@ handle_info({CloseTag, Socket}, StateName, next_event(StateName, no_record, State) end; handle_info(Msg, StateName, State) -> - ssl_connection:handle_info(Msg, StateName, State). -%%% ssl_connection:StateName(info, Msg, State, ?MODULE). + ssl_connection:StateName(info, Msg, State, ?MODULE). handle_common_event(internal, #alert{} = Alert, StateName, #state{negotiated_version = Version} = State) -> |