From d5fa5e53b882cd9849034399ac769d2b7e7d3179 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Fri, 28 May 2010 12:00:00 +0200 Subject: ssh: Patch 1119 OTP-8550 The function ssh:connect/4 was not exported. OTP-8644 Aligned error message with used version (SSH_FX_FAILURE vs SSH_FX_NOT_A_DIRECTORY, the latter introduced in version 6). OTP-8645 Resolved race condition when another connection is started before a channel is opened in the first connection. OTP-8535 The configuration parameter ip_v6_disabled is now available, which makes it possible for the user to alter the IP version SSH shall use. OTP-8534 The ssh_connection:send operation now accepts infinity as timeout. OTP-8524 The connection handler now include stack traces when a channel message is not handled correctly. --- lib/ssh/src/ssh_connection_manager.erl | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'lib/ssh/src/ssh_connection_manager.erl') diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl index 3863005e74..cffeade485 100644 --- a/lib/ssh/src/ssh_connection_manager.erl +++ b/lib/ssh/src/ssh_connection_manager.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -178,7 +178,7 @@ send_eof(ConnectionManager, ChannelId) -> %% {stop, Reason} %% Description: Initiates the server %%-------------------------------------------------------------------- -init([server, _Socket, Opts]) -> +init([server, _Socket, Opts, SubSysSup]) -> process_flag(trap_exit, true), ssh_bits:install_messages(ssh_connection:messages()), Cache = ssh_channel:cache_create(), @@ -187,7 +187,8 @@ init([server, _Socket, Opts]) -> channel_id_seed = 0, port_bindings = [], requests = [], - channel_pids = []}, + channel_pids = [], + sub_system_supervisor = SubSysSup}, opts = Opts, connected = false}}; @@ -272,18 +273,18 @@ handle_call({ssh_msg, Pid, Msg}, From, {stop, normal, State#state{connection_state = Connection}} catch exit:{noproc, Reason} -> - Report = io_lib:format("Connection probably terminated:~n~p~n~p~n", - [ConnectionMsg, Reason]), + Report = io_lib:format("Connection probably terminated:~n~p~n~p~n~p~n", + [ConnectionMsg, Reason, erlang:get_stacktrace()]), error_logger:info_report(Report), {noreply, State}; error:Error -> - Report = io_lib:format("Connection message returned:~n~p~n~p~n", - [ConnectionMsg, Error]), + Report = io_lib:format("Connection message returned:~n~p~n~p~n~p~n", + [ConnectionMsg, Error, erlang:get_stacktrace()]), error_logger:info_report(Report), {noreply, State}; exit:Exit -> - Report = io_lib:format("Connection message returned:~n~p~n~p~n", - [ConnectionMsg, Exit]), + Report = io_lib:format("Connection message returned:~n~p~n~p~n~p~n", + [ConnectionMsg, Exit, erlang:get_stacktrace()]), error_logger:info_report(Report), {noreply, State} end; @@ -400,7 +401,7 @@ handle_call({close, ChannelId}, _, end; handle_call(stop, _, #state{role = _client, - client = ChannelPid, + client = _ChannelPid, connection = Pid} = State) -> DisconnectMsg = #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, -- cgit v1.2.3