banjo-apn_sender 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apn_sender.gemspec +1 -1
- data/lib/apn/connection.rb +20 -27
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a66d23e5df5e3bf8ce14d1a434901309603085b
|
4
|
+
data.tar.gz: 04d6622680c2fa4d0436d97bc3756f827cdb1f29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00f01191ba90ef3eb1f7ff7fccb5b3a886c6ab5bf674c87682132ffcc9c331c326bc130b7ac52a91bb87d375c99740a2f0fef352796994d9ac7e1f5755604488
|
7
|
+
data.tar.gz: 66243395f85a449687a6b299fd85d1730c9f7418029f54cb30438b6eedfbc99a0d125049e41190cab0cf1d3146fc4830d80ccbdae577a777399f2843d0cabb67
|
data/apn_sender.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{banjo-apn_sender}
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Kali Donovan}, %q{KW Justin Leung}]
|
data/lib/apn/connection.rb
CHANGED
@@ -5,10 +5,11 @@ class APN::Connection
|
|
5
5
|
|
6
6
|
@production_senders = Hash.new
|
7
7
|
@sandbox_senders = Hash.new
|
8
|
-
@
|
8
|
+
@enterprise_senders = Hash.new
|
9
9
|
|
10
10
|
@production_last_accesses = Hash.new
|
11
11
|
@sandbox_last_accesses = Hash.new
|
12
|
+
@enterprise_last_accesses = Hash.new
|
12
13
|
|
13
14
|
def push_fifo(env, token)
|
14
15
|
@fifos[env] <<= token
|
@@ -58,29 +59,27 @@ class APN::Connection
|
|
58
59
|
epoch = Time.now.to_i
|
59
60
|
|
60
61
|
# Use only 1 single thread for internal enterprise cert
|
61
|
-
if enterprise
|
62
|
-
if @
|
63
|
-
@
|
62
|
+
if enterprise
|
63
|
+
if @enterprise_senders[thread_id] && (epoch - @enterprise_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
|
64
|
+
@enterprise_senders[thread_id].reconnect
|
65
|
+
end
|
66
|
+
|
67
|
+
@enterprise_last_accesses[thread_id] = epoch
|
68
|
+
@enterprise_senders[thread_id] ||= new(worker_count: 1, verbose: 1, enterprise: 1)
|
69
|
+
elsif sandbox
|
70
|
+
if @sandbox_senders[thread_id] && (epoch - @sandbox_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
|
71
|
+
@sandbox_senders[thread_id].reconnect
|
64
72
|
end
|
65
73
|
|
66
|
-
@
|
67
|
-
@
|
74
|
+
@sandbox_last_accesses[thread_id] = epoch
|
75
|
+
@sandbox_senders[thread_id] ||= new(worker_count: 1, sandbox: 1, verbose: 1)
|
68
76
|
else
|
69
|
-
if
|
70
|
-
|
71
|
-
@sandbox_senders[thread_id].reconnect
|
72
|
-
end
|
73
|
-
|
74
|
-
@sandbox_last_accesses[thread_id] = epoch
|
75
|
-
@sandbox_senders[thread_id] ||= new(worker_count: 1, sandbox: 1, verbose: 1)
|
76
|
-
else
|
77
|
-
if @production_senders[thread_id] && (epoch - @production_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
|
78
|
-
@production_senders[thread_id].reconnect
|
79
|
-
end
|
80
|
-
|
81
|
-
@production_last_accesses[thread_id] = epoch
|
82
|
-
@production_senders[thread_id] ||= new(worker_count: 1, verbose: 1)
|
77
|
+
if @production_senders[thread_id] && (epoch - @production_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
|
78
|
+
@production_senders[thread_id].reconnect
|
83
79
|
end
|
80
|
+
|
81
|
+
@production_last_accesses[thread_id] = epoch
|
82
|
+
@production_senders[thread_id] ||= new(worker_count: 1, verbose: 1)
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
@@ -94,13 +93,7 @@ class APN::Connection
|
|
94
93
|
tag = "#{sandbox ? 'sandbox' : 'production'}#{enterprise ? ' enterprise' : ''}"
|
95
94
|
sender.log(:info, "token: #{token} message: #{message}, style: #{style}")
|
96
95
|
debug = style[:debug] || (style[:debug_sample] && rand(style[:debug_sample].to_i) == 0)
|
97
|
-
|
98
|
-
if enterprise
|
99
|
-
@enterprise_semaphore.synchronize { sender.send_to_apple(msg, token, env, tag, debug) }
|
100
|
-
else
|
101
|
-
sender.send_to_apple(msg, token, env, tag, debug)
|
102
|
-
end
|
103
|
-
|
96
|
+
sender.send_to_apple(msg, token, env, tag, debug)
|
104
97
|
sender
|
105
98
|
end
|
106
99
|
|