apns_simple 0.8.0 → 0.8.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: 458059ecb443c898d82d6f7bce8f9d6c1cd79386
4
- data.tar.gz: e90411dc5d34a7891c2541c37314ebf243f3dbb0
3
+ metadata.gz: eec0b4e04de00e365c95c6c74dc18dbd832dfb16
4
+ data.tar.gz: 5aaecd12d555f4745abc64d908b29ea6614f31fb
5
5
  SHA512:
6
- metadata.gz: fdd5ab6692345cd1c317073120775e4d250228d8795b27b7fec998fbb465d3f42fa0496ee8bf19c430a13224f9379edcb73977ed15582c3afb32f2a05798a28d
7
- data.tar.gz: 2740ceaf52a4e12934ab9e1e36ab687e2c17967e4047b4e18dfa2c817eadfd5bd199ad09e4d27ef37ef6ba72403c3df273e43e41e609d033d8e6fd82d88f1fa4
6
+ metadata.gz: d665e823c3d2e01c716274c847411fa671f7024ca84e30a1f35eb9720b0cfa4d04293140f724e96a593b5fc90855521a8e0d73c91d51f88c24e54af1637fc75f
7
+ data.tar.gz: f4a4ad5eb5a5aab4a6b8d041601295d5cc03ab0bb661a78c8a85c23912666160437341efac0e0c4fa5ef3a2f03bd8f1df1f93fd6fc9172ec4e601e5a023efcac
@@ -22,6 +22,7 @@ module ApnsSimple
22
22
  10 => 'Shutdown',
23
23
  255 => 'Unknown error'
24
24
  }
25
+ TIMEOUT = 5 # In seconds
25
26
 
26
27
  def initialize(options)
27
28
  certificate = options.fetch(:certificate)
@@ -49,7 +50,12 @@ module ApnsSimple
49
50
  ssl.write(notification.payload)
50
51
  ssl.flush
51
52
 
52
- if IO.select([ssl], nil, nil, 1) && error = ssl.read(6)
53
+ unless IO.select([ssl], nil, nil, TIMEOUT)
54
+ notification.error = "No response from APNS server received in #{TIMEOUT} seconds. Exit by timeout."
55
+ return
56
+ end
57
+
58
+ if (error = ssl.read(6))
53
59
  command, status, _index = error.unpack("ccN")
54
60
  notification.error = command == COMMAND ? "#{status}: #{CODES[status]}" : "Unknown command received from APNS server: #{command}"
55
61
  end
@@ -1,3 +1,3 @@
1
1
  module ApnsSimple
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apns_simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Voronkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler