Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Read 38 bytes from SSL socket.

  • Loading branch information...
commit f57a864912b12c77bd6f9c9b0d1de77777de7f18 1 parent 43810a7
Tatsuya Suzuki authored chrisrhoden committed
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/apn_on_rails/libs/feedback.rb
View
7 lib/apn_on_rails/libs/feedback.rb
@@ -13,10 +13,9 @@ class << self
def devices(cert, &block)
devices = []
return if cert.nil?
- APN::Connection.open_for_feedback({:cert => cert}) do |conn, sock|
- while line = sock.gets # Read lines from the socket
- line.strip!
- feedback = line.unpack('N1n1H140')
+ APN::Connection.open_for_feedback({:cert => cert}) do |conn, sock|
+ while line = conn.read(38) # Read 38 bytes from the SSL socket
+ feedback = line.unpack('N1n1H140')
token = feedback[2].scan(/.{0,8}/).join(' ').strip
device = APN::Device.find(:first, :conditions => {:token => token})
if device
Please sign in to comment.
Something went wrong with that request. Please try again.