Skip to content

Commit 9075731

Browse files
committed
Add on_open_failed callback hook for multi channel
1 parent 8f4fd3f commit 9075731

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CHANGELOG.rdoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
=== unreleased
2+
3+
* Add Channel#on_open_failed callback hook [Jamis Buck]
4+
5+
16
=== 1.0.0 / 1 May 2008
27

38
* (no changes since the last preview release)

lib/net/ssh/multi/channel.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,20 @@ def on_eof(&block)
199199
self
200200
end
201201

202+
# Registers a callback on all component channels, to be invoked when the
203+
# remote server is unable to open the channel. The callback will be
204+
# invoked with three arguments: the channel object that couldn't be
205+
# opened, a description of the error (as a string), and an integer code
206+
# representing the error.
207+
#
208+
# channel.on_open_failed do |ch, description, code|
209+
# # ...
210+
# end
211+
def on_open_failed(&block)
212+
channels.each { |channel| channel.on_open_failed(&block) }
213+
self
214+
end
215+
202216
# Registers a callback on all component channels, to be invoked when the
203217
# remote server sends a channel request of the given +type+. The callback
204218
# will be invoked with two arguments: the specific channel object receiving

0 commit comments

Comments
 (0)