aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_connection_manager.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2012-03-22 16:23:27 +0100
committerIngela Anderton Andin <[email protected]>2012-03-22 17:49:04 +0100
commita06cd043eab256539459d765a4856fc156ed96d4 (patch)
treea4e97035e5d9b1a8e3d4bae4df21e9aac61f1167 /lib/ssh/src/ssh_connection_manager.erl
parentb2b96f8b37143e760cfe6638c6c4b3bd34604e1f (diff)
downloadotp-a06cd043eab256539459d765a4856fc156ed96d4.tar.gz
otp-a06cd043eab256539459d765a4856fc156ed96d4.tar.bz2
otp-a06cd043eab256539459d765a4856fc156ed96d4.zip
ssh:close/1 will no longer crash if ssl manager already happens to have
been terminated. The function ssh_connection_manager:call now handles that exit reason may be shutdown.
Diffstat (limited to 'lib/ssh/src/ssh_connection_manager.erl')
-rw-r--r--lib/ssh/src/ssh_connection_manager.erl22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl
index 406a042d72..e993f597a5 100644
--- a/lib/ssh/src/ssh_connection_manager.erl
+++ b/lib/ssh/src/ssh_connection_manager.erl
@@ -144,27 +144,21 @@ adjust_window(ConnectionManager, Channel, Bytes) ->
cast(ConnectionManager, {adjust_window, Channel, Bytes}).
close(ConnectionManager, ChannelId) ->
- try call(ConnectionManager, {close, ChannelId}) of
- ok ->
+ case call(ConnectionManager, {close, ChannelId}) of
+ ok ->
ok;
- {error, channel_closed} ->
- ok
- catch
- exit:{noproc, _} ->
+ {error, channel_closed} ->
ok
- end.
+ end.
stop(ConnectionManager) ->
- try call(ConnectionManager, stop) of
+ case call(ConnectionManager, stop) of
ok ->
ok;
{error, channel_closed} ->
ok
- catch
- exit:{noproc, _} ->
- ok
end.
-
+
send(ConnectionManager, ChannelId, Type, Data, Timeout) ->
call(ConnectionManager, {data, ChannelId, Type, Data}, Timeout).
@@ -591,7 +585,9 @@ call(Pid, Msg, Timeout) ->
catch
exit:{timeout, _} ->
{error, timeout};
- exit:{normal, _} ->
+ exit:{normal} ->
+ {error, channel_closed};
+ exit:{{shutdown, _}, _} ->
{error, channel_closed};
exit:{noproc,_} ->
{error, channel_closed}