lead_zeppelin 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,8 @@ Fast, threaded client for the Apple Push Notification Service.
4
4
 
5
5
  ## Installation
6
6
 
7
+ Lead Zeppelin requires Ruby 1.9. It is tested on MRI. Because it uses threads, it probably runs better on JRuby and Rubinius, but has not yet been tested (feedback welcome).
8
+
7
9
  Add this line to your application's Gemfile:
8
10
 
9
11
  gem 'lead_zeppelin'
@@ -70,6 +72,7 @@ To watch the thread flow, pass an IO to LeadZeppelin#thread_logger (but not a Lo
70
72
  ## TODO
71
73
 
72
74
  * *TESTING*
75
+ * Gateway and sandbox mode
73
76
  * Way to handle errors asynchronously using a pool
74
77
  * Performance and concurrency speedups
75
78
  * Edge cases
@@ -29,7 +29,7 @@ module LeadZeppelin
29
29
  timeout: (@opts[:connection_pool_timeout] || CONNECTION_POOL_TIMEOUT)}
30
30
 
31
31
  @gateway_connection_pool = ConnectionPool.new(cp_args) do
32
- Gateway.new @ssl_context, (@opts[:gateway_opts] || {}).merge(error_block: @opts[:error_block])
32
+ Gateway.new @ssl_context, (@opts[:gateway_opts] || {}).merge(error_block: @opts[:error_block], application_name: @name)
33
33
  end
34
34
  end
35
35
 
@@ -9,8 +9,9 @@ module LeadZeppelin
9
9
  Logger.thread 'c'
10
10
  @semaphore = Mutex.new
11
11
  @opts = opts
12
+ @applications = {}
12
13
 
13
- self.instance_eval &configure
14
+ self.instance_eval &configure if configure
14
15
 
15
16
  # FIXME
16
17
  @thread_count = Queue.new
@@ -21,9 +21,12 @@ module LeadZeppelin
21
21
  timeout(@opts[:timeout] || DEFAULT_TIMEOUT) do
22
22
  socket = TCPSocket.new((@opts[:apns_host] || HOST), (@opts[:apns_port] || PORT))
23
23
  ssl_socket = OpenSSL::SSL::SSLSocket.new socket, @ssl_context
24
+
24
25
  ssl_socket.sync_close = true # when ssl_socket is closed, make sure the regular socket closes too.
25
26
  ssl_socket.connect
26
27
 
28
+ # FIXME TODO CHECK FOR EOFError HERE instead of in process_error
29
+
27
30
  @semaphore.synchronize do
28
31
  @socket = socket
29
32
  @ssl_socket = ssl_socket
@@ -67,7 +70,13 @@ module LeadZeppelin
67
70
  @opts[:error_block].call(error)
68
71
  end
69
72
 
73
+ rescue EOFError
74
+ # FIXME put in a certificate error pre-check and perhaps an error block for handling this.
75
+ # A better solution is the remove the application altogether from the client..
76
+ Logger.error "Invalid certificate for #{@opts[:application_name]}, reconnecting for now.."
77
+ reconnect
70
78
  rescue IO::WaitReadable
79
+ # No data to read, continue
71
80
  Logger.thread 'g'
72
81
  end
73
82
  end
@@ -1,3 +1,3 @@
1
1
  module LeadZeppelin
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lead_zeppelin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.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-06-07 00:00:00.000000000 Z
12
+ date: 2012-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json