rpush 2.3.0 → 2.3.1

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: cb54c6c92d5ad11dd4f3d170572f99b3006946fd
4
- data.tar.gz: 28d949f1e16204e0d0e60dfe2605df73dd21787d
3
+ metadata.gz: 0da1cac03ae3688486b3d3a35f9adf1aff283bed
4
+ data.tar.gz: 3710bfdf83a7fd76a790a42d4ee95278ed07f7e2
5
5
  SHA512:
6
- metadata.gz: 9d6652491605ad6a2952313df88ee9c2282a3b3613f6ee03d8d92fb54f93117c0404742a78f684ebb01efdd734d434de2c9179a3c2e42a2ecbef36460370027a
7
- data.tar.gz: 9112453e724420282a58c33a5c43175d02226987d335e9189e3830465e1692fe5ac18ea91c5cd39c092f43b6279afa9db92bcb11d51f0ec8919b512949502f9a
6
+ metadata.gz: e84ccee43191d9876c30f4df293299dc8c4d08de3ad96882aec3eb7fc0302217d32de0b1bede2faa296d686a9fa4c451ebb8a27a0560f664dcb5d578765465ae
7
+ data.tar.gz: 6cd9310c439cb97f8eab52456303d94b3c2c43872498a7c361f6343031b545476c2200707b1645f462de2b151fe585b6b476234edf7864a6875fe3c69a4156e6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.3.1 (Jan 24, 2015)
2
+ * Fix CPU thrashing while waiting for an APNs connection be established (#119).
3
+
1
4
  ## 2.3.0 (Jan 19, 2015)
2
5
  * Add 'version' CLI command.
3
6
  * Rpush::Wpns::Notification now supports setting the 'data' attribute.
@@ -23,7 +23,7 @@ module Rpush
23
23
  super
24
24
  @dispatch_mutex = Mutex.new
25
25
  @stop_error_receiver = false
26
- start_error_receiver
26
+ @connection.on_connect { start_error_receiver }
27
27
  end
28
28
 
29
29
  def dispatch(payload)
@@ -70,6 +70,8 @@ module Rpush
70
70
 
71
71
  tuple = @connection.read(ERROR_TUPLE_BYTES)
72
72
  @dispatch_mutex.synchronize { handle_error_response(tuple) }
73
+ rescue StandardError => e
74
+ log_error(e)
73
75
  end
74
76
 
75
77
  def handle_error_response(tuple)
@@ -26,13 +26,29 @@ module Rpush
26
26
  @certificate = app.certificate
27
27
  @password = app.password
28
28
  @connected = false
29
+ @connection_callbacks = []
29
30
  touch
30
31
  end
31
32
 
33
+ def on_connect(&blk)
34
+ raise 'already connected' if @connected
35
+ @connection_callbacks << blk
36
+ end
37
+
32
38
  def connect
33
39
  @ssl_context = setup_ssl_context
34
40
  @tcp_socket, @ssl_socket = connect_socket
35
41
  @connected = true
42
+
43
+ @connection_callbacks.each do |blk|
44
+ begin
45
+ blk.call
46
+ rescue StandardError => e
47
+ log_error(e)
48
+ end
49
+ end
50
+
51
+ @connection_callbacks.clear
36
52
  end
37
53
 
38
54
  def close
data/lib/rpush/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rpush
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpush
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2015-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json