forward 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,10 +57,9 @@ module Forward
57
57
 
58
58
  Forward.log(:debug, "Starting remote forward at #{@tunnel.subdomain}.fwd.wf on port #{@tunnel.port}")
59
59
  puts "Forwarding port #{@tunnel.hostport} at \033[04mhttps://#{@tunnel.subdomain}.fwd.wf\033[m\nCtrl-C to stop forwarding"
60
- Net::SSH.start(@tunnel.tunneler, Forward.ssh_user, @client.ssh_options) do |session|
61
- session.forward.remote(@tunnel.hostport, @tunnel.host, @tunnel.port)
62
- session.loop { watch_session(session) }
63
- end
60
+ @session = Net::SSH.start(@tunnel.tunneler, Forward.ssh_user, @client.ssh_options)
61
+ @session.forward.remote(@tunnel.hostport, @tunnel.host, @tunnel.port)
62
+ @session.loop { watch_session(@session) }
64
63
 
65
64
  rescue Net::SSH::AuthenticationFailed => e
66
65
  Forward.log(:fatal, "SSH Auth failed `#{e}'")
@@ -72,6 +71,8 @@ module Forward
72
71
 
73
72
  def self.cleanup_and_exit!(message = 'exiting...')
74
73
  puts message
74
+
75
+ @session.close if @session && !@session.closed?
75
76
  if @client && @client.tunnel && @client.tunnel.id
76
77
  Forward.log(:debug, "Cleaning up tunnel: `#{@client.tunnel.id}'")
77
78
  @client.tunnel.cleanup
@@ -1,3 +1,3 @@
1
1
  module Forward
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forward
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
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-10-02 00:00:00.000000000 Z
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json