diff options
author | Ingela Anderton Andin <[email protected]> | 2014-12-17 09:51:05 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2014-12-17 09:51:05 +0100 |
commit | 7c657ba949e51d6d176af82a5e56f9e68f5a3b1c (patch) | |
tree | c078be649f93953dabe671c317117aedcc4c47bb /lib/ssh/src/ssh_connection_handler.erl | |
parent | 2d3cb60287e158e2cbc48e9b8a0b87b00267544b (diff) | |
parent | 75ca7672b5c7bb07196a3a2b294157479ff4f00a (diff) | |
download | otp-7c657ba949e51d6d176af82a5e56f9e68f5a3b1c.tar.gz otp-7c657ba949e51d6d176af82a5e56f9e68f5a3b1c.tar.bz2 otp-7c657ba949e51d6d176af82a5e56f9e68f5a3b1c.zip |
Merge branch 'ia/ssh/ssh-connection-protocol-timeout/OTP-12004' into maint
* ia/ssh/ssh-connection-protocol-timeout/OTP-12004:
ssh: Improve errorhandling in ssh_connection.erl
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}; |