aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_connection_handler.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2011-05-16 16:10:48 +0200
committerErlang/OTP <[email protected]>2011-05-16 16:10:48 +0200
commit26b854ade6f1d89379f6337b18dde32e9abb9615 (patch)
tree05aa46f994c61f0dc068b857c76f8ff2e8b993db /lib/ssh/src/ssh_connection_handler.erl
parent7050c922b25fe1306caffc7545a89e0ddc1de06a (diff)
parentb95606315ee69c56f231558c58ad87de77cb28f3 (diff)
downloadotp-26b854ade6f1d89379f6337b18dde32e9abb9615.tar.gz
otp-26b854ade6f1d89379f6337b18dde32e9abb9615.tar.bz2
otp-26b854ade6f1d89379f6337b18dde32e9abb9615.zip
Merge branch 'nick/ssh/handle_unexpected_msg/OTP-9273' into maint-r14
* nick/ssh/handle_unexpected_msg/OTP-9273: An unexpected message would crash the ssh_connection_handler and close the connection. Now an error message is generated instead.
Diffstat (limited to 'lib/ssh/src/ssh_connection_handler.erl')
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 3193be2510..00b30e5434 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -569,7 +569,19 @@ handle_info({CloseTag, _Socket}, _StateName,
#state{transport_close_tag = CloseTag, %%manager = Pid,
ssh_params = #ssh{role = _Role, opts = _Opts}} = State) ->
%%ok = ssh_connection_manager:delivered(Pid),
- {stop, normal, State}.
+ {stop, normal, State};
+handle_info(UnexpectedMessage, StateName, #state{ssh_params = SshParams} = State) ->
+ Msg = lists:flatten(io_lib:format(
+ "Unexpected message '~p' received in state '~p'\n"
+ "Role: ~p\n"
+ "Peer: ~p\n"
+ "Local Address: ~p\n", [UnexpectedMessage, StateName,
+ SshParams#ssh.role, SshParams#ssh.peer,
+ proplists:get_value(address, SshParams#ssh.opts)])),
+ error_logger:info_report(Msg),
+ {next_state, StateName, State}.
+
+
%%--------------------------------------------------------------------
%% Function: terminate(Reason, StateName, State) -> void()
%% Description:This function is called by a gen_fsm when it is about