aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src
diff options
context:
space:
mode:
authorNiclas Eklund <[email protected]>2010-06-16 12:00:00 +0200
committerBjörn Gustavsson <[email protected]>2010-08-23 14:12:38 +0200
commitcc621c57ce7c41c2b46a103136575bca445aedd0 (patch)
tree6c79612758187dec2a481d88ae8ac9737777b561 /lib/ssh/src
parentd2bfa9b07aab133d2fe6f4ab0241bd758cd988e8 (diff)
downloadotp-cc621c57ce7c41c2b46a103136575bca445aedd0.tar.gz
otp-cc621c57ce7c41c2b46a103136575bca445aedd0.tar.bz2
otp-cc621c57ce7c41c2b46a103136575bca445aedd0.zip
ssh: Patch 1126
OTP-8714 SSH in some cases terminated channels with reason normal when it should have been shutdown.
Diffstat (limited to 'lib/ssh/src')
-rw-r--r--lib/ssh/src/ssh.appup.src2
-rw-r--r--lib/ssh/src/ssh_channel.erl24
2 files changed, 19 insertions, 7 deletions
diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src
index dac8f55eaa..1042355112 100644
--- a/lib/ssh/src/ssh.appup.src
+++ b/lib/ssh/src/ssh.appup.src
@@ -19,6 +19,7 @@
{"%VSN%",
[
+ {"1.1.9", [{load_module, ssh_channel, soft_purge, soft_purge, []}]},
{"1.1.8", [{restart_application, ssh}]},
{"1.1.7", [{restart_application, ssh}]},
{"1.1.6", [{restart_application, ssh}]},
@@ -28,6 +29,7 @@
{"1.1.2", [{restart_application, ssh}]}
],
[
+ {"1.1.9", [{load_module, ssh_channel, soft_purge, soft_purge, []}]},
{"1.1.8", [{restart_application, ssh}]},
{"1.1.7", [{restart_application, ssh}]},
{"1.1.6", [{restart_application, ssh}]},
diff --git a/lib/ssh/src/ssh_channel.erl b/lib/ssh/src/ssh_channel.erl
index 3d67065ee1..dcb2d69290 100644
--- a/lib/ssh/src/ssh_channel.erl
+++ b/lib/ssh/src/ssh_channel.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%
%%
@@ -238,9 +238,19 @@ handle_info(Msg, #state{cm = ConnectionManager, channel_cb = Module,
{noreply, State#state{channel_state = ChannelState}};
{ok, ChannelState, Timeout} ->
{noreply, State#state{channel_state = ChannelState}, Timeout};
+ {stop, Reason, ChannelState} when is_atom(Reason)->
+ {stop, Reason, State#state{close_sent = true,
+ channel_state = ChannelState}};
{stop, ChannelId, ChannelState} ->
- ssh_connection:close(ConnectionManager, ChannelId),
- {stop, normal, State#state{close_sent = true,
+ Reason =
+ case Msg of
+ {'EXIT', _Pid, shutdown} ->
+ shutdown;
+ _ ->
+ normal
+ end,
+ (catch ssh_connection:close(ConnectionManager, ChannelId)),
+ {stop, Reason, State#state{close_sent = true,
channel_state = ChannelState}}
end.