apns_simple 1.1.0 → 1.1.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: 51268e8fa7d8d4eef9af6e2dfa9d7c8403cb1518
4
- data.tar.gz: dcd4161167952f0638ab5c6125968f94a6d78145
3
+ metadata.gz: 885ffeb9c1c47bc2dbdce4e9544583333805c6eb
4
+ data.tar.gz: 224b07b0dc020a6f6728713018f0c771f2ec5710
5
5
  SHA512:
6
- metadata.gz: 7efb6608223756f87afc446e36e58c9070dea16113e730eb6e52ba839d4fd98d0785219dfca2840066def30ef76471ee51269f0ce410444c43f0dc99ce5bf1a9
7
- data.tar.gz: afe120a7462aac8ec1a2c69cb90038111ff27d755b5ad486977ba9d487a0e47d07493fe2f7bcc3fac1f7cea49f02f80f7384d53118564000c149b47f210e64af
6
+ metadata.gz: 87420a1bcd041e9edb43b3ae76a89a5a328cb36f56f19326bdf0b1fa01e15229e5e4fe9261e34d2d3e795f4763c010b3162362d48ea73972087bd00eaad3eb8b
7
+ data.tar.gz: c96326ca6e2dac6a58a24bd583a2d6fab6b99922318382d32108350beadd6ffab934e5cfa72f4e5d6af305cb2216ca3e09fc818b2f1788ebebd8a99217c28786
@@ -46,33 +46,26 @@ module ApnsSimple
46
46
  end
47
47
 
48
48
  def push(notification)
49
- notification.error = true
50
49
  sock = TCPSocket.new(host, port)
51
50
  ssl = OpenSSL::SSL::SSLSocket.new(sock, ssl_context)
51
+ ssl.sync = true
52
52
  ssl.connect
53
53
  ssl.write(notification.payload)
54
- ssl.flush
55
54
 
56
- ready = IO.select([ssl], [], [], TIMEOUT)
57
-
58
- unless ready
59
- notification.error_message = "No response from APNS server received in #{TIMEOUT} seconds. Exit by timeout."
60
- return
61
- end
62
-
63
- readable_ssl_socket = ready.first.first
64
-
65
- if (error = readable_ssl_socket.read(ERROR_BYTES_COUNT))
66
- command, code, _index = error.unpack('ccN')
67
- if command == COMMAND
68
- notification.error_code = code
69
- notification.error_message = "CODE: #{code}, DESCRIPTION: #{CODES[code]}"
70
- else
71
- notification.error_message = "Unknown command received from APNS server: #{command}"
55
+ if (ready = IO.select([ssl], [], [], TIMEOUT))
56
+ readable_ssl_socket = ready.first.first
57
+ if (error = readable_ssl_socket.read(ERROR_BYTES_COUNT))
58
+ command, code, _index = error.unpack('ccN')
59
+ notification.error = true
60
+ if command == COMMAND
61
+ notification.error_code = code
62
+ notification.error_message = "CODE: #{code}, DESCRIPTION: #{CODES[code]}"
63
+ else
64
+ notification.error_message = "Unknown command received from APNS server: #{command}"
65
+ end
72
66
  end
73
- else
74
- notification.error = false
75
67
  end
68
+
76
69
  ensure
77
70
  ssl.close if ssl
78
71
  sock.close if sock
@@ -1,3 +1,3 @@
1
1
  module ApnsSimple
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apns_simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Voronkov