aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_connection_handler.erl
diff options
context:
space:
mode:
authorNiclas Eklund <[email protected]>2010-10-06 15:19:22 +0200
committerNiclas Eklund <[email protected]>2010-10-06 15:19:22 +0200
commit24c67e110e2219c269454566126ad0885ee57bdc (patch)
treef7848721ce1b165e15169973aae4b0d917ec0aba /lib/ssh/src/ssh_connection_handler.erl
parent5ddf44bb91540fd88e604f077d71482c40185cd8 (diff)
downloadotp-24c67e110e2219c269454566126ad0885ee57bdc.tar.gz
otp-24c67e110e2219c269454566126ad0885ee57bdc.tar.bz2
otp-24c67e110e2219c269454566126ad0885ee57bdc.zip
In some cases a crash report was generated when a connection was closing down.
This was caused by a race condition between two processes.
Diffstat (limited to 'lib/ssh/src/ssh_connection_handler.erl')
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 822ef8f8f9..926d4fddce 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -705,11 +705,19 @@ generate_event(<<?BYTE(Byte), _/binary>> = Msg, StateName,
Byte == ?SSH_MSG_CHANNEL_REQUEST;
Byte == ?SSH_MSG_CHANNEL_SUCCESS;
Byte == ?SSH_MSG_CHANNEL_FAILURE ->
- ssh_connection_manager:event(Pid, Msg),
- State = generate_event_new_state(State0, EncData),
- next_packet(State),
- {next_state, StateName, State};
+ try
+ ssh_connection_manager:event(Pid, Msg),
+ State = generate_event_new_state(State0, EncData),
+ next_packet(State),
+ {next_state, StateName, State}
+ catch
+ exit:{noproc, _Reason} ->
+ Report = io_lib:format("~p Connection Handler terminated: ~p~n",
+ [self(), Pid]),
+ error_logger:info_report(Report),
+ {stop, normal, State0}
+ end;
generate_event(Msg, StateName, State0, EncData) ->
Event = ssh_bits:decode(Msg),
State = generate_event_new_state(State0, EncData),