em-ssh 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/em-ssh/ext/net/ssh/connection/channel.rb +24 -0
- data/lib/em-ssh/version.rb +1 -1
- data/lib/em-ssh.rb +2 -0
- metadata +3 -2
@@ -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
|
data/lib/em-ssh/version.rb
CHANGED
data/lib/em-ssh.rb
CHANGED
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.
|
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-
|
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
|