kw_apn 0.4 → 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -1,6 +1,13 @@
1
+ ====================================
2
+ About
3
+ ====================================
4
+
5
+ Push Notification Library with support for the extended format. This Library is designed to send thousands of APNs at once without dropping a lot of messages on errors. Since version 0.4 it supports the use of multiple App IDs with one process.
6
+
1
7
  ====================================
2
8
  Getting Started
3
9
  ====================================
10
+
4
11
  For Rails start the generator: kw_apn
5
12
  This will copy the configuration example into your project.
6
13
 
@@ -52,7 +59,7 @@ Example
52
59
 
53
60
 
54
61
  ====================================
55
- Configuring for multiple App IDs
62
+ Multiple App IDs
56
63
  ====================================
57
64
 
58
65
  Since version 0.4 it is possible to use kw_apn with multiple App IDs.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4
1
+ 0.5
data/kw_apn.gemspec CHANGED
@@ -7,11 +7,11 @@ end
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'kw_apn'
9
9
  s.version = version
10
- s.authors = ['Jonathan Cichon', 'Kupferwerk GmbH']
10
+ s.authors = ['Jonathan Cichon', 'Andreas Gerauer', 'Kupferwerk GmbH']
11
11
  s.email = 'cichon@kupferwerk.com'
12
12
  s.homepage = 'http://github.com/kupferwerk/kw_apn'
13
13
  s.summary = 'APN Lib by Kupferwerk'
14
- s.description = 'Apple Push Notification Library by Kupferwerk'
14
+ s.description = 'Apple Push Notification Library by Kupferwerk. Supports extended format with feedback.'
15
15
  s.has_rdoc = true
16
16
  s.extra_rdoc_files = ['README.rdoc']
17
17
  s.require_path = 'lib'
data/lib/config.rb CHANGED
@@ -50,8 +50,7 @@ module KwAPN
50
50
  def option(opt, app_id = nil)
51
51
  @options || load_options
52
52
  opt = opt.to_sym
53
- app_id = app_id.to_sym
54
- if app_id && @options[app_id] && @options[app_id][opt]
53
+ if app_id && (app_id = app_id.to_sym) && @options[app_id] && @options[app_id][opt]
55
54
  @options[app_id][opt]
56
55
  else
57
56
  @options[opt]
data/lib/connection.rb CHANGED
@@ -7,6 +7,7 @@ module KwAPN
7
7
 
8
8
  def connect(host, port, app_id = nil)
9
9
  ctx = OpenSSL::SSL::SSLContext.new()
10
+
10
11
  ctx.cert = OpenSSL::X509::Certificate.new(File.read(KwAPN::Config.option(:cert_file, app_id)))
11
12
  ctx.key = OpenSSL::PKey::RSA.new(File.read(KwAPN::Config.option(:cert_file, app_id)))
12
13
 
data/lib/sender.rb CHANGED
@@ -80,28 +80,33 @@ private
80
80
  # wait for apple to respond errors
81
81
  sleep(1)
82
82
  rescue => e
83
+ @watch_thread.join
84
+
83
85
  if @last_error_index.nil?
84
86
  # stop watchthread as the connection should be allready down
85
- @watch_thread.exit
86
87
  self.class.log("(#{app_id} - #{session_id}) Exception at index #{counter+index}: #{e.message}")
87
88
  @failed_index_array << (counter+index)
88
89
  failed
89
90
  else
90
91
  # should be interrupted by watchthread, do nothing wait for restart
91
92
  end
93
+
92
94
  end
93
95
  end
94
96
 
95
97
  def perform_watch
96
- ret = @ssl.read
97
- err = ret.strip.unpack('CCN')
98
- if err[1] != 0 and err[2]
99
- @last_error_index = (err[2] - ID_OFFSET)
100
- @failed_index_array << @last_error_index
101
- failed
102
- @work_thread.exit
103
- else
104
- perform_watch
98
+ begin
99
+ ret = @ssl.read
100
+ err = ret.strip.unpack('CCN')
101
+ if err[1] != 0 and err[2]
102
+ @last_error_index = (err[2] - ID_OFFSET)
103
+ @failed_index_array << @last_error_index
104
+ failed
105
+ @work_thread.exit
106
+ else
107
+ perform_watch
108
+ end
109
+ rescue => e
105
110
  end
106
111
  end
107
112
 
metadata CHANGED
@@ -1,25 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kw_apn
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- version: "0.4"
8
+ - 5
9
+ version: "0.5"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonathan Cichon
13
+ - Andreas Gerauer
13
14
  - Kupferwerk GmbH
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-09-07 00:00:00 +02:00
19
+ date: 2011-02-18 00:00:00 +01:00
19
20
  default_executable:
20
21
  dependencies: []
21
22
 
22
- description: Apple Push Notification Library by Kupferwerk
23
+ description: Apple Push Notification Library by Kupferwerk. Supports extended format with feedback.
23
24
  email: cichon@kupferwerk.com
24
25
  executables: []
25
26