summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2008-09-16 08:40:27 -0600
committerJamis Buck <jamis@37signals.com>2008-09-16 08:40:27 -0600
commit90757310038d4e2b0e54fd11ab0f2ccc01f6e04e (patch)
tree0f37aec3bf5dc5e03a7365d5dcab28355b0bf1d3
parent8f4fd3fe372ddcc46bac39586b6185d17bb67c51 (diff)
downloadnet-ssh-multi-90757310038d4e2b0e54fd11ab0f2ccc01f6e04e.tar.gz
Add on_open_failed callback hook for multi channel
-rw-r--r--CHANGELOG.rdoc5
-rw-r--r--lib/net/ssh/multi/channel.rb14
2 files changed, 19 insertions, 0 deletions
diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc
index 520491b..2ccb3c8 100644
--- a/CHANGELOG.rdoc
+++ b/CHANGELOG.rdoc
@@ -1,3 +1,8 @@
+=== unreleased
+
+* Add Channel#on_open_failed callback hook [Jamis Buck]
+
+
=== 1.0.0 / 1 May 2008
* (no changes since the last preview release)
diff --git a/lib/net/ssh/multi/channel.rb b/lib/net/ssh/multi/channel.rb
index 4c1f80c..34bd117 100644
--- a/lib/net/ssh/multi/channel.rb
+++ b/lib/net/ssh/multi/channel.rb
@@ -200,6 +200,20 @@ module Net; module SSH; module Multi
end
# Registers a callback on all component channels, to be invoked when the
+ # remote server is unable to open the channel. The callback will be
+ # invoked with three arguments: the channel object that couldn't be
+ # opened, a description of the error (as a string), and an integer code
+ # representing the error.
+ #
+ # channel.on_open_failed do |ch, description, code|
+ # # ...
+ # end
+ def on_open_failed(&block)
+ channels.each { |channel| channel.on_open_failed(&block) }
+ self
+ end
+
+ # Registers a callback on all component channels, to be invoked when the
# remote server sends a channel request of the given +type+. The callback
# will be invoked with two arguments: the specific channel object receiving
# the request, and a Net::SSH::Buffer instance containing the request-specific