diff options
author | Ingela Anderton Andin <[email protected]> | 2014-12-15 09:54:26 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2014-12-17 09:41:35 +0100 |
commit | 75ca7672b5c7bb07196a3a2b294157479ff4f00a (patch) | |
tree | c078be649f93953dabe671c317117aedcc4c47bb /lib/ssh/src/ssh_connection_handler.erl | |
parent | 2d3cb60287e158e2cbc48e9b8a0b87b00267544b (diff) | |
download | otp-75ca7672b5c7bb07196a3a2b294157479ff4f00a.tar.gz otp-75ca7672b5c7bb07196a3a2b294157479ff4f00a.tar.bz2 otp-75ca7672b5c7bb07196a3a2b294157479ff4f00a.zip |
ssh: Improve errorhandling in ssh_connection.erl
If a channel is closed by the peer while using a function with call semantics
in ssh_connection.erl return {error, closed}. Document that the functions
can return {error, timeout | closed} and not only ssh_request_status()
Diffstat (limited to 'lib/ssh/src/ssh_connection_handler.erl')
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index fdb9d3b3e6..915060c426 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -289,8 +289,13 @@ renegotiate_data(ConnectionHandler) -> -spec close(pid(), channel_id()) -> ok. %%-------------------------------------------------------------------- close(ConnectionHandler, ChannelId) -> - sync_send_all_state_event(ConnectionHandler, {close, ChannelId}). - + case sync_send_all_state_event(ConnectionHandler, {close, ChannelId}) of + ok -> + ok; + {error, closed} -> + ok + end. + %%-------------------------------------------------------------------- -spec stop(pid()) -> ok | {error, term()}. %%-------------------------------------------------------------------- @@ -1204,7 +1209,11 @@ sync_send_all_state_event(FsmPid, Event) -> sync_send_all_state_event(FsmPid, Event, infinity). sync_send_all_state_event(FsmPid, Event, Timeout) -> - try gen_fsm:sync_send_all_state_event(FsmPid, Event, Timeout) + try gen_fsm:sync_send_all_state_event(FsmPid, Event, Timeout) of + {closed, _Channel} -> + {error, closed}; + Result -> + Result catch exit:{noproc, _} -> {error, closed}; |