em-ssh 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ module Net; module SSH; module Connection
2
+ # Moneky patching is the root of all evil.
3
+ #
4
+ # Net:SSH::Connection::Channel doesn't expect its #connection to every be
5
+ # nil. EM::Ssh unsets the Channels @connection to facilitate garbage
6
+ # collection when the session is closed. Anything that maintains a reference
7
+ # to a Channel could still call Channel#wait, Channel#active?, so we need a
8
+ # guard in those methods.
9
+ #
10
+ # TODO be a good citizen. Verify that the possible memory leak in
11
+ # EM::Ssh::Session is also possible in Net::SSHi::Connection and submit a
12
+ # pull request with fixes.
13
+ class Channel
14
+ def active?
15
+ return unless connection
16
+ connection.channels.key?(local_id)
17
+ end
18
+
19
+ def wait
20
+ return unless connection
21
+ connection.loop { active? }
22
+ end
23
+ end
24
+ end; end; end
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  class Ssh
3
- VERSION='0.4.2'
3
+ VERSION='0.4.3'
4
4
  end # class::Ssh
5
5
  end # module::EventMachine
data/lib/em-ssh.rb CHANGED
@@ -81,3 +81,5 @@ require 'em-ssh/server-version'
81
81
  require 'em-ssh/packet-stream'
82
82
  require 'em-ssh/authentication-session'
83
83
  require 'em-ssh/session'
84
+ # load our evil monkey patch
85
+ require 'em-ssh/ext/net/ssh/connection/channel'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -87,6 +87,7 @@ files:
87
87
  - lib/em-ssh/authentication-session.rb
88
88
  - lib/em-ssh/callbacks.rb
89
89
  - lib/em-ssh/connection.rb
90
+ - lib/em-ssh/ext/net/ssh/connection/channel.rb
90
91
  - lib/em-ssh/log.rb
91
92
  - lib/em-ssh/packet-stream.rb
92
93
  - lib/em-ssh/server-version.rb