Permalink
Browse files

Fix crash reports when client already closes channel

Under heavy load with the Maverick client it happens quite often that
the Erlang SSH server is in the process of answering an EOF when the
channel is already closed. This leads to many big scary (and misleading)
error reports. This commit solves the problem.
  • Loading branch information...
1 parent 460f97d commit 218f5daa9c8a275defc3722e69fdf0e4a39a1de4 Attila Rajmund Nohl committed Feb 16, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/ssh/src/ssh_connection.erl
@@ -377,8 +377,13 @@ handle_msg(#ssh_msg_channel_failure{recipient_channel = ChannelId},
handle_msg(#ssh_msg_channel_eof{recipient_channel = ChannelId},
#connection{channel_cache = Cache} = Connection0, _, _) ->
- Channel = ssh_channel:cache_lookup(Cache, ChannelId),
- {Reply, Connection} = reply_msg(Channel, Connection0, {eof, ChannelId}),
+ {Reply, Connection} =
+ case ssh_channel:cache_lookup(Cache, ChannelId) of
+ undefined ->
+ {[], Connection0};
+ Channel ->
+ reply_msg(Channel, Connection0, {eof, ChannelId})
+ end,
{{replies, [Reply]}, Connection};
handle_msg(#ssh_msg_channel_close{recipient_channel = ChannelId},

0 comments on commit 218f5da

Please sign in to comment.