envoy-proxy 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca6d987ba03b0bff1210d45d8873c0a07390a933
4
- data.tar.gz: e711d10fcc536e57a0047205c22c99137c893d5d
3
+ metadata.gz: ef2118712910e35819c817d33c0e2d6b7f9d502b
4
+ data.tar.gz: 88ae6105ccd8b45c4c21b2ca5f3550eaec77de9f
5
5
  SHA512:
6
- metadata.gz: 2934a325d2927833734dedf8689869b91e07fcba2b5baecf729e523d7a44f8b2eb1d98d4e6ad7b414e1643ecb1310afb6eb3b8cf0ae3b725610dcbdabb589a15
7
- data.tar.gz: f7cbaf2cf87fbbc65f0be8a010852c516bffa44e250eb1cf299f9b309be80963da29b84e32f13d11e55889507fa718eee2bec8c97f438685009174ec792913bb
6
+ metadata.gz: f37e81842ec29acd108aa83d71f9d0a8b802d8b5e47cc914a2b134110b525c133aeecdad66ad530a13a7210b32f8ec9fed8f28e6f0b52f9ee751d04369d19e70
7
+ data.tar.gz: 57e5090d881c0d67b267114332cb8a9665f1c22a2e8e2f98dbf06610f475b9ae8313169367caeb826b5723991e0ff7ef5f9fec6d21a8639210a1769eb8667ce7
@@ -49,7 +49,6 @@ end
49
49
 
50
50
  unless EM.reactor_running?
51
51
  EM.run do
52
- EM.connect options[:server_host], options[:server_port].to_i, Envoy::Client::Trunk, options
52
+ Envoy::Client::Trunk.start options
53
53
  end
54
54
  end
55
-
@@ -9,6 +9,10 @@ module Envoy
9
9
 
10
10
  attr_reader :options
11
11
 
12
+ def self.start options
13
+ EM.connect options[:server_host], options[:server_port].to_i, Envoy::Client::Trunk, options
14
+ end
15
+
12
16
  def initialize options
13
17
  @options = options
14
18
  end
@@ -47,10 +51,25 @@ module Envoy
47
51
  end
48
52
 
49
53
  def unbind
50
- EM.stop_event_loop
54
+ if @options[:reconnect]
55
+ STDERR.puts "No connection. Reconnecting in #{@options[:reconnect]}s."
56
+ EM.add_timer @options[:reconnect] do
57
+ @options[:reconnect] *= 2
58
+ Trunk.start @options
59
+ end
60
+ else
61
+ if options[:did_connect]
62
+ STDERR.puts "Connection lost. Not point reconnecting because the host is randomly generated."
63
+ else
64
+ STDERR.puts "Couldn't connect. Abandoning ship."
65
+ end
66
+ receive_halt
67
+ end
51
68
  end
52
69
 
53
70
  def ssl_handshake_completed
71
+ options[:did_connect] = true
72
+ options[:reconnect] = 1 if options[:hosts]
54
73
  o = options.dup
55
74
  o.delete(:local_host)
56
75
  send_object :options, o
@@ -63,5 +82,4 @@ module Envoy
63
82
  end
64
83
 
65
84
  end
66
- end
67
-
85
+ end
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Envoy
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envoy-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Baum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-07 00:00:00.000000000 Z
11
+ date: 2013-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine