diff options
author | Miklós Fazekas <mfazekas@szemafor.com> | 2016-03-26 11:11:35 +0100 |
---|---|---|
committer | Miklós Fazekas <mfazekas@szemafor.com> | 2016-03-26 11:11:35 +0100 |
commit | b82d4e965fdcd6d011b49ea7b2bdb0d285b62a63 (patch) | |
tree | ea44d20d6acf75a709b384198fbfcd81c6ac5e95 /lib/net/ssh/connection | |
parent | 9f505d9f04c692d8e443912ed4a6b0fcc95619db (diff) | |
parent | c1714d7512514fd2a09c9c7931451cd5ab1f159a (diff) | |
download | net-ssh-4.0.0.alpha2.tar.gz |
Merge pull request #340 from mfazekas/close-chns-on-tr-closev4.0.0.alpha2
Close channels if trasport closed
Diffstat (limited to 'lib/net/ssh/connection')
-rw-r--r-- | lib/net/ssh/connection/session.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/net/ssh/connection/session.rb b/lib/net/ssh/connection/session.rb index eac0721..de53766 100644 --- a/lib/net/ssh/connection/session.rb +++ b/lib/net/ssh/connection/session.rb @@ -475,6 +475,9 @@ module Net; module SSH; module Connection send(MAP[packet.type], packet) end + rescue + force_channel_cleanup_on_close if closed? + raise end # Returns the next available channel id to be assigned, and increments @@ -483,6 +486,16 @@ module Net; module SSH; module Connection @channel_id_counter += 1 end + def force_channel_cleanup_on_close + channels.each do |id, channel| + channel.remote_closed! + channel.close + + cleanup_channel(channel) + channel.do_close + end + end + # Invoked when a global request is received. The registered global # request callback will be invoked, if one exists, and the necessary # reply returned. |