Permalink
Browse files

fix feedback

  • Loading branch information...
ramigg committed Jan 4, 2012
1 parent 742e59c commit d48aa8b10842983bafa84236e27052cb3b58cc00
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/apn_on_rails/libs/feedback.rb
@@ -13,10 +13,10 @@ class << self
def devices(cert, &block)
devices = []
return if cert.nil?
- APN::Connection.open_for_feedback({:cert => cert}) do |conn, sock|
+ 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
+ feedback = line.unpack('N1n1H140')
+ token = feedback[2].strip
device = APN::Device.find(:first, :conditions => {:token => token})
if device
device.feedback_at = Time.at(feedback[0])
@@ -25,7 +25,7 @@ def devices(cert, &block)
end
end
devices.each(&block) if block_given?
- return devices
+ devices
end # devices
def process_devices

0 comments on commit d48aa8b

Please sign in to comment.