ileitch/rapns — pull request #14 by blakewatters (2011-11-04 16:40:19+00:00)
Title: Rescue SSL Errors and Trigger Reconnect Logic

With the rapns push notification server running over night, I am seeing a huge flood of Airbrakes and a stalled daemon when I wake up in the morning. Looking at the backtrace, the error is a **OpenSSL::SSL::SSLError: SSL_write:: bad write retry** coming from:

```
/usr/local/lib/ruby/1.9.1/openssl/buffering.rb:235:in `syswrite'
/usr/local/lib/ruby/1.9.1/openssl/buffering.rb:235:in `do_write'
/usr/local/lib/ruby/1.9.1/openssl/buffering.rb:249:in `write'
vendor/bundle/ruby/1.9.1/bundler/gems/rapns-fbcb5164c4bc/lib/rapns/daemon/connection.rb:38:in `write'
vendor/bundle/ruby/1.9.1/bundler/gems/rapns-fbcb5164c4bc/lib/rapns/daemon/delivery_handler.rb:28:in `block in handle_next_notification'
```

I have added this SSLError to the connection retry logic in the connection.rb code and updated the specs.