relayrides/pushy — pull request #102 by mdvorak (2014-06-27 10:55:51+00:00)
Title: Automatic delay for replacing failed connections to avoid servers throttling

When there is a problem with connection, either wrong SSL certificate or any other reason connection is rejected, pushy ends up in infinite loop, causing hundreds connection attempts in second, eating up system resources but more can block server ip in firewall or Apple itself.

I've added automatic delaying of reopening failed connection, starting at 100ms and increasing up tu 5mins by default. Does not affect reopening of gracefully closed connection.
Can be disabled by setting maxReconnectDelay on PushManager to 0.

*It is missing proper unit tests, as I'm solving development issue and I don't have time to investigate how to write such complex test. Sorry about that, I like to have everything tested otherwise.*

Any feedback is welcome. For me, this feature is must-have.